Avlesh Singh
let the search begin
Avlesh
27, Male
Mumbai
avlesh kumar singh

JsonRequest-Demo


Type any URL which you want to send a JSON request to and "include" the reponse in this page
Sample usage of JsonRequest
function myJsonRequestSendingFunction(requestUrl){
  /* create a new instance of the JsonRequest class */
  var myRequest = new JsonRequest(requestUrl);
	
  /* if paramters are to be passed along with this request,
   * use the API as follows 
   */
  myRequest.setParam("param-name1", "value1");	
  myRequest.setParam("param-name2", "value2");	
  myRequest.setParam("param-name3", "value3");	
  
  /* set a default expected charset for 
   * the response. if you are using this framework to
   * transfer data to third party sites, make sure that this
   * is the encoding that you want for your data to display 
   * correctly; otherwise, default encoding for your content
   * would be the encoding of the site from which the request 
   * originated.
   */
  myRequest.setCharset("ISO-8859-1");

  /* if you specify this parameter, corresponding function 
   * would be called after the response is received. 
   * Will throw a JS error, if the 
   * function is not present.
   */
  myRequest.setCallbackFunction(myCallbackFunction);

  /* when set to true, this parameter would check for
   * the response type to be application/x-javascript
   * which is done via performing a HEAD request to the
   * URL first. You would NOT need this, if the target 
   * URL is in your domain. 
   */
  myRequest.setValidateResponseType(true);
  myRequest.setVerboseOn(true);

  /* UI indicator */
  myRequest.setLoadingIndicator(myHtmlObject);
  
  /* huh! common do what you were supposed to do now */
  myRequest.open();
}
								
I am open to suggestions, ideas and criticism.
icon courtesy - http://www.iconfinder.net | feel free to copy material from this site | avlesh.com