Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class IlvAjax

IlvAjax

Category:
Common component
JavaScript File:
IlvUtil.js
Description:
This class manages AJAX (Asynchronous JavaScript with XML) requests on the different browser supported. If is not necessary to create an IlvAjax instance, but you should rather directly call the methods, for exemple:
var fRef = function(jsonString) {
var data=eval("("+jsonString+")");// we suppose the server returns JSON data
  ... do something with data
};
var myRequestURL="http://myserver:8080/myapp/someurl?dothis"
var requestContent ="server, here is the information you need";
IlvAjax.post(myRequestURL, requestContent, null, fRef, null);
Or
var client=this; //use closure
var fRef = function(jsonObject) {
  client.doSomething(jsonObject);
};
var jsrequest = new IlvAjax.JSRequest(this, fRef);
jsrequest.send(myRequestURL);

Constructor Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
IlvAjax. get(url, xhr, oncompleted, onfailed)
Asynchronously sends GET requests to the server that can be sending back data fragments.
 
IlvAjax. HTMLRequest(obj, oncompleted, onfailed)
This class allows to asynchronously send to the server requests that are sending back HTML fragments.
 
IlvAjax. JSRequest(obj, oncompleted, onfailed)
This class allows to asynchronously send to the server requests that are sending back JSON fragments.
 
IlvAjax. loadJS(url)
Synchronously loads a specified JavaScript file.
 
IlvAjax. post(url, content, xhr, oncompleted, onfailed)
Asynchronously sends POST requests to the server that can be sending back data fragments.
Constructor Detail
IlvAjax
IlvAjax()
Method Detail
get
<static> IlvAjax.get(url, xhr, oncompleted, onfailed)
Asynchronously sends GET requests to the server that can be sending back data fragments.
Parameters:
{Object} url - the url of the request
{Object} xhr - the object that contains an AJAX request to reuse (null is recommended)
{Function} oncompleted - the function to be called on completion of the request. The function should have the following prototype: function oncompleted(content) where content is the data sent by the server.
{Function} onfailed - the function to be called on error, or null.

HTMLRequest
<static> IlvAjax.HTMLRequest(obj, oncompleted, onfailed)
This class allows to asynchronously send to the server requests that are sending back HTML fragments.
Parameters:
{Object} obj - the object that will use the request object
{Function} oncompleted - the function to be called on completion of the request. The function should have the following prototype: function oncompleted(content) where content is the sent HTML.
{Function} onfailed - the function to be called on error.

JSRequest
<static> IlvAjax.JSRequest(obj, oncompleted, onfailed)
This class allows to asynchronously send to the server requests that are sending back JSON fragments.
Parameters:
{Object} obj - the object that will use the request object
{Function} oncompleted - the function to be called on completion of the request. The function should have the following prototype: function oncompleted(context) where context a javascript object evaluated from the JSON fragment received from the server.
{Function} onfailed - the function to be called on error.

loadJS
<static> IlvAjax.loadJS(url)
Synchronously loads a specified JavaScript file. This function loads and executes the specified JavaScript file. It does not return until the file is loaded and executed. It has the same result as a HTML Script element.
Parameters:
url - The url of the JavaScript file to load.
Since:
JViews 8.7

post
<static> IlvAjax.post(url, content, xhr, oncompleted, onfailed)
Asynchronously sends POST requests to the server that can be sending back data fragments.
Parameters:
{Object} url - the url of the request
{Object} content - the content of the POST
{Object} xhr - the object that contains an AJAX request to reuse (null is recommended)
{Function} oncompleted - the function to be called on completion of the request. The function should have the following prototype: function oncompleted(content) where content is the data sent by the server.
{Function} onfailed - the function to be called on error, or null.

©Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.