Andyram2k
04-23-2010, 12:09 AM
Hi all,
Thanks for taking the time to read my post.
I've written a very simple JQuery $.AJAX post script to query a JSON output on a HTTPS server, and i'm using JSONP to retrieve this information.
As it stands, i can alert the data on success (alert(data), which gives me the whole JSON file output, but i cannot parse this into data that i can then use on the page (i.e. data.testdataitem).
The script:
<script type="text/javascript">
jQuery(document).ready(function(){
$.ajaxSetup({
jsonp : 'jsoncallback',
type: 'POST',
data: {testdataitem : 'value'},
cache : false
});
$.ajax({
url: 'https://myurl.htm',
success: function(data) {
alert(data);
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(xhr.responseText);
}
});
});
</script>
JSON output:
[{"testdataitem":"value","testdataitem2":"value2"}]
In Firefox, i'm receiving a xhr.status of 0, and am getting "permission denied" errors in the main browsers.
Can anyone shed any light onto why this wouldn't be working, or if i've missed something really simple?
Thanks again.
Andy.
Thanks for taking the time to read my post.
I've written a very simple JQuery $.AJAX post script to query a JSON output on a HTTPS server, and i'm using JSONP to retrieve this information.
As it stands, i can alert the data on success (alert(data), which gives me the whole JSON file output, but i cannot parse this into data that i can then use on the page (i.e. data.testdataitem).
The script:
<script type="text/javascript">
jQuery(document).ready(function(){
$.ajaxSetup({
jsonp : 'jsoncallback',
type: 'POST',
data: {testdataitem : 'value'},
cache : false
});
$.ajax({
url: 'https://myurl.htm',
success: function(data) {
alert(data);
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(xhr.responseText);
}
});
});
</script>
JSON output:
[{"testdataitem":"value","testdataitem2":"value2"}]
In Firefox, i'm receiving a xhr.status of 0, and am getting "permission denied" errors in the main browsers.
Can anyone shed any light onto why this wouldn't be working, or if i've missed something really simple?
Thanks again.
Andy.