from.. 2013-01-28 12:37 采纳率: 100%
浏览 34

跨域ajax调用+ PHP

I want to get data from the webservices through jquery ajax call(cross domain). After fetching data from webservices, i need to show it as a dataTable using php. Can anyone help me regarding this or just give me some sampe examples.

my ajax function is as follows:

$.ajax({
      type: "POST",

      url:"my webservice url",

      //data: json,
      //contentType: "application/json; charset=utf-8",
      crossDomain: true,
      dataType: 'json',
      async:false,

      success: function(data, textStatus, jqXHR)
          {
              alert("Download success");
              alert(data);
          },
          error : function(jqXHR, exception) 
          {
              alert(jqXHR.status);
          }
      });
  • 写回答

2条回答 默认 最新

  • weixin_33736649 2013-01-28 13:38
    关注
    $.ajax({
       url:"yourPageName.php",
       dataType: 'jsonp', // N.B! JSONP   It is lower Case OK?
       success:function(json){
         // json (an  Array)
         alert("Success");
     },
     error:function(){
         alert("Error");
     },
    

    });

    For more info please visit here http://api.jquery.com/jQuery.ajax/

    评论

报告相同问题?

悬赏问题

  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏