Grant Whiting
asked on
Call load() function after ajax Success
I am trying to do a partial page re-load after my ajax POST returns successful. I have tried putting the load() function in the Success callback but it never gets triggered. I know it's not a problem with the load() function itself because I can run it in the console and it works fine. How do I run it on success? Thanks.
$("#saveNewTask").click(function () {
$.ajax({
cache: false,
url: url,
data: data,
type: "POST",
error: function (e) {
console.log(e);
alert("Error creating new task");
},
success: function (response) {
$('#mainTaskWrapper').load('/Tasks #mainTaskWrapper');
}
});
});
Are you certain that the success clause is being invoked? Have you placed an alert or console.log statement in the success clause to confirm that it is being invoked? There are situations in which neither the error or success clause will be invoked.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I made a mistake and was set on the right path by Julian Hansen.