Submitting the form without refreshing the page is used on more sites than other types of JavaScript. This process allows the user to stay on the current page without losing their position.
Take Facebook, for example. If this technology were not available, you would lose your spot on the page every time you comment on someone else's post. And as websites get bigger and more users make posts online, it will only worsen, and that is where [Ajax] comes in to soothe the beast we call the Internet.


Using this AJAX script, we have to do something a little different from what we would normally do when passing data to our back-end processing page. We will need a hidden field with an ID value that we can pass via AJAX to our back-end.

CFFCS | CarrzSynEdit: | HTML (Hyper Text Markup Language)

<input type="submit" name="Submit" tabindex="3" style="width:150px;" value="Code" id="Update" onClick="document.getElementById('SubmitForm').value='Code';" />
<input type="hidden" id="SubmitForm" name="SubmitForm" value="" />



First, we have our button, and since AJAX cannot retrieve a button's value, we will need some JavaScript trickery to pass it along.
This is where the Hidden field comes in. We will retrieve the value from the Submit button, and then add it to our page. This way, we can use code like this:
CFFCS | CarrzSynEdit: | ASP/VBScript

<%
If request.form("Code") then
'Information goes here.

else
'Some other information goes here.

end if
%>