总进入error,是因为返回的json串格式不对,后台必须返回如:xxxxx({"name":"value","name":"value"}) 格式串,其中xxxxx是callback的方法名。
- $.ajax({
- url: "http://timer.com/timer1?refresh=" + new Date().getTime(),type: "GET",crossDomain: true,dataType: 'jsonp',async: false,jsonp:'callback'
- success: function(data){
- console.log(err);
- },error: function (xhr,status,err){
- console.log(err);
- }
- });