I am relatively new to jQuery and also a Javascript novice so apologies if this is a basic error which I am not seeing.
I want to make multiple $.ajax calls from the same 'hook' (don't know if this is the correct term, but let's say a 'start' button) to get separate pieces of data from the server using page methods within an .aspx page and insert them into separate divs within the page.
The relevant code is:
$(document).ready(function () {
$("#btnGo").click(function () {
$.ajax({
type: "POST",
url: "callback3.aspx/GetIntro",
data: "{}",
contentType: "application/json",
async: "false",
dataType: "json",
success: function (msg1) { $("#Intro").html(msg1.d); }
});
$("#btnGo").hide();
$.ajax({
type: "POST",
url: "callback3.aspx/GetQuestion",
data: "{}",
contentType: "application/json",
async: "false",
dataType: "json",
success: function (msg2) { $("#Question").html(msg2.d); }
});
});
});
Calls to both page methods work, but only in the first case is the result inserted into the target div. It does not seem to make any difference whether the calls are async or not. I assume that what I am trying to do is possible, so any advice on what I need to do to make this work would be gratefully received.
Jon