Reputation: 47743
I've got a javascript function I created. Somewhere in that function, this line is called:
var divContent = getDataAsyncHtml(dialogDiv.attr("winHref"));
I'm not sure why the .ajax is not being invoked once it hits my getDataAsyncHtml function. Do I need a function() ?
function getDataAsynHtml(urlWithContent)
{
alert("urlWithContent: " + urlWithContent);
// jQuery async request
$.ajax(
{
url: urlWithContent,
success: function(data) {
return $('.result').html(data);
alert('Load was performed.');
}
});
}
Upvotes: 0
Views: 67
Reputation: 308
You will never get alert in $.ajax function you wrote, because alert goes after return ... . It must look like this:
$.ajax(
{
url: urlWithContent,
success: function(data) {
alert('Load was performed.');
return $('.result').html(data);
}
});
Upvotes: 1
Reputation: 5579
Add an error function to see if you are just not getting a success returned.
$.ajax({
url: urlWithContent,
success: function(data) {
alert('Success');
}, error: function(e) {
alert('Error: ' + e);
}
});
Upvotes: 0