dongwen7187 2012-08-22 20:24
浏览 17

jquery无法获得webservice响应

So... I'm ordered :'( to create a information system for a heavy machinery rent firm, wich have a GPS for every machine, the data from the GPS is prvided by another an external firm wich uses a web services. (I'm very lost with these project...)

I need to (load at least) read data from a web service, to populate a DB with it, the web service respond comma separated data, and in another cases it respond the same, but is a .txt inside a .zip.

so when it just echoes the in a page... it seems like these:

0
739,-70.61692,-33.44053,0,0,2005-10-03 13:54:15.0,Cada 00:02:00 hh:mm:ss.
739,-70.61685,-33.44038,0,0,2005-10-03 13:19:00.0,Detención Mayor a 2 Min.
739,-70.61682,-33.44040,0,0,2005-10-03 13:14:47.0,Cada 00:02:00 hh:mm:ss.
739,-70.61685,-33.44040,0,0,2005-10-03 12:56:09.0,Detención Mayor a 2 Min.
739,-70.61683,-33.44037,0,0,2005-09-21 03:19:23.0,Cada 00:02:00 hh:mm:ss.
739,-70.61738,-33.44057,0,0,2005-09-21 03:16:45.0,Detención Mayor a 2 Min.
739,-70.62070,-33.44182,0,0,2005-09-21 03:14:41.0,Cada 00:02:00 hh:mm:ss.
739,-70.62060,-33.44165,0,0,2005-09-21 03:09:44.0,Cada 00:02:00 hh:mm:ss.
739,-70.61685,-33.44040,0,0,2005-09-21 01:05:31.0,Cada 00:02:00 hh:mm:ss.
……
……
……
739,-70.61687,-33.44040,0,0,2005-09-21 01:00:35.0,Cada 00:02:00 hh:mm:ss.
739,-70.61685,-33.44038,0,0,2005-09-21 00:56:02.0,Detencion Mayor a 2 Min.
FIN

the zipped data looks exactly like that. But I can't even manage to load the data, so How am I supposed to work with it, i.e. use it to feed a database (which is actually what I want to do)

the Jquery code I'm using looks like these:

  $("a").click(function(event){
      event.preventDefault();
      var webdir = $(this).attr("href");
      alert("I'm supposed to load the following URL: "+webdir);       
      $.ajax({
      url: webdir,
      success: function(data){
          $('#resultado').html(data);
          alert('Load was performed.');
      }
      }).fail(function(){ 
      alert("error"); 
      });//this at least throws an error
  });

-you can see a working (failing to be honest) example-

And I'm not even capable to get the data, and I don't even know if I need to get the data using jquery, or if I have to get it using PHP.... so please, help me with the jquery... then if you have time, point in the right direction on how to populate a DB with data from a WEB service like these.

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)