简体   繁体   中英

How to call a url and get response from it in javascript

我想通过传递一些参数来调用url,并且我想处理来自javascript中该URL的响应。

You're looking for AJAX.

There are a number of exceptional libraries out there that take most of the work off your hands, I like jQuery, but have a used a few others (Prototype, Dojo etc).

From the jQuery docs:

$.get('ajax/test.html', function(data) {
  $('.result').html(data);
  alert('Load was performed.');
});

http://api.jquery.com/jQuery.get/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM