I have token value in a URL like http://example.com/api.php?action=token
I need to consume this URL data which is a random string, I'm trying with following code:
var jqxhr = $.get("http://example.com/api.php?action=token", function() {
alert( "success" );
})
.done(function() {
alert( "second success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "finished" );
});
// Perform other work here ...
// Set another completion function for the request above
jqxhr.always(function() {
alert( "second finished" );
});
Using $.get()
While trying to load, it's showing an error. I'm just stuck with it, how to get the data?