Is it possible to pass a function to the url field in an ajax call? I want to dynamically pass a different url to the ajax call made.
function getMeURL(){}
$.ajax({
url: getMeURL,
context: document.body,
success: function(){
$(this).addClass("done");
}
});
You can pass the result of a function, but not a function itself as you seem to be trying to do. Here’s an updated example (notice the parentheses):