js跨域推送

   var urlJ = "http://asdf.com?json="+ss+"&dategy=" + Math.round(Math.random() * 10000);

 alert(urlJ);

 var script = document.createElement('script');
 script.src= urlJ;
 script.type = 'text/javascript';
 document.getElementsByTagName('body')[0].appendChild(script);
 script.onload = script.onreadystatechange = function(){
        if(!this.onload || /loaded|complete/.test(this.readyState)){
           
    alert(sendNewsResult.result);
    alert(sendNewsResult.items);
    alert(sendNewsResult.saveItems);
    if(sendNewsResult.result=="true"){

    alert("推送成功!成功推送"+sendNewsResult.saveItems+"条!");
    }else{
    
    if(sendNewsResult.items==-1){

    alert("推送失败,参数为空!");
    }else if(sendNewsResult.items==-2){

    alert("推送失败,参数格式不对!");
    }else if(sendNewsResult.items==-3){

    alert("此碎片不能进行wap推送!");
    }else{

    alert("推送失败!");
    }

    }
  }
 }

你可能感兴趣的:(js跨域推送)