$(document).ready(function() {
$("#firstTimeSubmit").click(function(event) {
event.preventDefault();
var name = $("#firstTimeText").val();
if (name == "" || name.length > 12) {
$("#updates").html("<b>Dummy! Invalid name!</b>");
} else {
$.ajax({
type: "GET",
url: "http://hiscore.runescape.com/index_lite.ws?player=" + name,
success: function() {
$.ajax({
type: "POST",
url: "includes/handlers/firsttime.php",
data: { name: name },
success: function() {
$("#updates").html("<b>Now tracking: " + name + "</b>");
},
error: function() {
$("#updates").html("<b>Already being tracked.</b>");
}
});
},
error: function() {
$("#updates").html("<b>Name doesn't exist.</b>");
} }
});
}
});
});
Should the $.ajax request inside the other $.ajax request work?