JQuery 1.5 released with improved JSONP handling

69 views
Skip to first unread message

Martin Duffy

unread,
Jan 31, 2011, 6:19:21 PM1/31/11
to River of news
Looks like jQuery 1.5 is now out and is has improved handling of JSONP
so no need for jquery.jsonp-1.0.4.min.js , I've given it a quick test
with the following code...

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/
jQuery/jquery-1.5.min.js"></script>


function getFeed(uri) {
// Assign handlers immediately after making the request, and
remember the jxhr object for this request
var jxhr = $.ajax({ url: uri , dataType: "jsonp" , timeout:
1000 , jsonpCallback : "onGetRiverStream" })
.success(function(data,status) {
$
("#newsTmpl").tmpl(data).appendTo("#newsFeed");
})
.error(function(status) {
var textStatus = status.statusText

if ( textStatus == "timeout")
$("#newsFeed").text("Sorry, your
request to scripting.com has timed out, please try again later");
else if ( textStatus == "parsererror")
$("#newsFeed").text("Sorry, response
from scripting.com is corrupted, please try again later");
else
$("#newsFeed").text("Error, status: "
+ textStatus + ", please try again later" );

});
}

For more details see http://blog.jquery.com/2011/01/31/jquery-15-released/
Reply all
Reply to author
Forward
0 new messages