I am wanting to write some code to return some data from an aJax call.
Here is the resource that I am referring to: http://www.w3schools.com/jquery/ajax_ajax.asp
Here is the code that I have written:
var data = getData("http://www.file.txt", function(result));
alert(data);
function getData(dataUrl, result)
{
$.ajax({url: dataUrl, success: function(result){
return result;
}});
}
I am getting the following error:
Uncaught SyntaxError: Unexpected token )
At this line of code:
var data = getData("http://www.file.txt", function(result));
Also, is the above code efficient when getting large amounts of data?
Thanks