Most AJAX books and samples demonstrated using the XMLHttpRequest object are for making AJAX calls but the main problem was compatibility between the different web browsers - IE vs Firefox vs Safari vs Opera.
So I wrote my own AJAX library, I mainly used it for validation and later to pull customer information into a HTML form if the customer already placed an order.
To use it:
Setup 1: Include the JavaScript file into your HTML page.
Setup 2: Call AjaxValidate function, this function has 3 parameters:
Setup 3: When the result comes back it will call the setOutput JavaScript function that has 3 parameters:
- psWebPage: The back-end server side page to call.
- psCode: Code that identifies the request, if you send more than one request to a back-end server side pagethen this can be used to identify the request so that the page handles different request. You can leave this blank if your page handles only 1 request.
- psValue: The request value.
- sWebPage: The back-end server side page that was called.
- sCode: The code sent to AjaxValidate function your JavaScript can process the request.
- sResponseText: The response from the AJAX call. This can be HTML, plain text or even JSON.
More about AJAX in the next Weekly Source Code.
Setup 2: Call AjaxValidate function, this function has 3 parameters:
- psWebPage: The back-end server side page to call.
- psCode: Code that identifies the request, if you send more than one request to a back-end server side pagethen this can be used to identify the request so that the page handles different request. You can leave this blank if your page handles only 1 request.
- psValue: The request value.
- sWebPage: The back-end server side page that was called.
- sCode: The code sent to AjaxValidate function your JavaScript can process the request.
- sResponseText: The response from the AJAX call. This can be HTML, plain text or even JSON.
More about AJAX in the next Weekly Source Code.
No comments:
Post a Comment