Grow your CSS skills. Land your dream job.

How to make Ajax work in wordpress

  • # March 27, 2013 at 12:58 pm

    hi,
    I m trying to call a different page template from one page template with AJAX however its not working wordpress.

    $(‘#one’).click(function(){
    $.ajax({
    url:’frame1.php’,
    success:function(data){
    $(‘#taquislider’).html(data);
    }
    });
    });

    I googled it but every tutorial is about getting the post and categories but how do I call a page in wordpress through AJAX.
    Thanks

    # March 28, 2013 at 11:17 am

    ?????

    # April 4, 2013 at 6:11 am

    No one can answer??

    # April 4, 2013 at 6:33 am

    I suspect not, no. You haven’t given much information, you see.

    1) frame1.php doesn’t look like a wordpress query, so you might need to confirm that it is, or that it is not intended to be.

    2) It would be sensible to give a link to the page in question. That way, it is simple to assess whether the problem is with your backend, or if it is an html/js problem.

    3) You should probably provide the server-side code too.

    Finally, consider clarifying what it is you are hoping to achieve. You say above that you are wanting to call different templates. Is that what you mean? It looks like you are trying to get information to insert into a slider.

    # April 4, 2013 at 7:04 am

    I m sorry I didn’t realize that the information was not sufficient.
    So let me put my question this way(only the part where I m having problem).
    I have a button on a page(let’s say single.php)
    and I m trying to fetch all the data( only html) from another page(Which I have created for this purpuse lets say frame1.php) on the click of this button.
    We can do it easily with the function I have shown above outside of wordpress however it doesn’t fetch any data from the other page in wordpress.
    I read online that wordpress has a different way of making AJAX call, but they dont explain the thing I m trying to achieve.
    Thanks for replying.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".