admin管理员组

文章数量:1334185

I have a button, the event would be onclick and then the javascript function will send to server the request(for example a rating button on an item), the page should not be redirected, basically I want the event to happen in the background. How to do that? Please give me some idea or code.

I have a button, the event would be onclick and then the javascript function will send to server the request(for example a rating button on an item), the page should not be redirected, basically I want the event to happen in the background. How to do that? Please give me some idea or code.

Share Improve this question asked Mar 7, 2011 at 7:04 Rn2dyRn2dy 4,19012 gold badges44 silver badges59 bronze badges 1
  • 1 The keyword is AJAX. Please google for it. – deceze Commented Mar 7, 2011 at 7:07
Add a ment  | 

3 Answers 3

Reset to default 4

Wele to the marvelous world of AJAX. One of the issues with ajax calls is that different browsers have different implementations of ajax. It's better if you can use a javascript library that abstracts these differences. I'd suggest you to pick up jQuery. You can make ajax calls in jQuery using $.get(), $.post() or $.ajax()

Check out jQuery.ajax.

you can use jquery ajax to achieve your goal. Its quite simple :)

本文标签: how to send a http request in the background in javascriptStack Overflow