This answer has helped me largely but hasn't fully resolved my issues. I'm using code similar to that, which is:
function getResponse() {
var the_url = "http://www.myurl.com/api/get";
$.ajax({
url: the_url,
dataType: 'jsonp',
type: 'get',
success: function(data) {
var json_response = data;
alert(data);
}
});
}
Basically, instead of just posting a url I need to post a curl because of authentication.
The example works fine with the simple url, but what I am wanting to use for 'the_url' is this:
var the_url = 'curl -u username:password "http://www.myurl.com/api/get"';
This is where I am having issues which means the success statement is never reached.
What is the best way to resolve this, and if it's not achievable could someone recommend the best workaround?
Thanks in advance.