I want to enhance my tool’s page where as soon use click a button. Request goes to server and depending upon return type (fail/pass) i change color of button. No Refresh/page reload
Page has multiple buttons : some what like below.
Name 9-11 - 11-2 2-5
Resource1 - Button - Button - Button
Resource2 - Button - Button - Button
Resource1 - Button - Button - Button
I am a c++ programmer so you might feel i asked a simple question
Here’s a sample of jQuery Ajax posting a
Form. Personally, I’m unfamiliar with PHP but Ajax is the same no matter what. You just need to post to something that can returnSuccess = trueorfalse. This POST happens asynchronously so you don’t get a page refresh unless you do something specific in thesuccess:section.Of course you don’t have to be doing a
POSTeither, it could be aGETAnd if you don’t need to pass any data just leave
data:section out. But if you want to specify the data you can withdata: { paramName: yourValue },The
cache: false,line can be left out if you want to cache the page. Seeing as how you aren’t going to show any changes you can remove that line. jQuery appends a unique value to the Url so as to keep it from caching. Specifyingtype: "json",or whatever your specific type is, is always a good idea but not necessary.