1

Here is my current code:

$.ajax({
   type: "POST"
   , url: "first-script.php"
   , data: {
      dataPoint: dataValue
   }
   , success: function (dataPath) {
      // Do stuff with dataPath

      // Call another PHP script once done.
   }
 });

I am stuck at the Call another PHP script once done. part. How can I do that? Is it possible at all? Is there any alternate way?

6
  • 1
    Another ajax request? Commented Jan 2, 2017 at 20:48
  • 1
    just add another Ajax request that's all Commented Jan 2, 2017 at 20:48
  • @RossWilson Do I just need to nest the requests? Commented Jan 2, 2017 at 20:49
  • @SarathKumar Should I add the AJAX request inside the success callback? Commented Jan 2, 2017 at 20:50
  • 1
    Yeah, that should do it :) Commented Jan 2, 2017 at 20:51

1 Answer 1

1

Nest the ajax with previous ajax request success call back:

$.ajax({
type: "POST",
url: "first-script.php",
data: {
        dataPoint: dataValue
     },
success: function (dataPath) {
  //Another request
  $.ajax({});
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.