Skip to content Skip to sidebar Skip to footer

Ajax Inside An Ajax Success

i made an ajax website that call php pages from a /pages folder inside my index.php, inside my page painting.php i have a link that call painting-slider.php page. so how can i open

Solution 1:

a simple example of "ajax after ajax":

$.ajax({
    url: "pages/" + page,
    cache: false,
    success: function(html) {
        afficher(html, page);
        if (storeHistory === true) {
            history.pushState({
                'key': 'value',
                'url': page
            }, '', page);
        }
        $.ajax({
          url: otherUrl,
          cache: false,
          success: function(result) {
            alert("i am the second result");
            alert(result);
          }
      });
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
        afficher('erreur lors du chagement de la page');
    }
});

On the serverside (your PHP files) it is not important to do anything. Your ajax will just get the return value of the script found at the given Urls. I hope it helps

Post a Comment for "Ajax Inside An Ajax Success"