If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: getdata()

well I don't have the AJAX for dummies book, but I'll give it a shot.

the getData() javascript method is just an arbitrary name the sample in the book is using. it could be called anything. by looking at the received arguments (datasource,divID) i'd say that datasource is the name of the 'listening' servlet URL (I'm using Java for my example) and divID is the ID of the DIV tag whose contents you are going to replace with the resulting XML response.

your method will construct a URL on the fly, retrieving form parameters the user has entered, or clicked on.
eg:

on the other end (java sample) you have a servlet written to receive a 'GET' method, build a query based on the passed in parameters, then construct an XML document from the returned database results. send the XML object back out, add the servlet to your WEB.XML configuration file, and it's ready to roll.

parseMessages() will receive the passed parameter (the XML document returned from the server) and simply construct a DIV tag heirarchy (or whatever you program it to do) that will then replace the innerHTML of the received divID argument. then you can simply allow CSS to position and format the objects rewritten to the document.

Re: getdata()

Hello firend

thanks for answer

I'm reading another book about AJAX

From AJAX in action page 47

When the user logs in or otherwise initializes a session, several server-side
objects are created, representing, say, the shopping basket and the customer credentials
if this is an e-commerce site. At the same time, the home page is dished
up to the browser, in a stream of HTML markup that mixes together standard
boilerplate presentation and user-specific data and content such as a list of
recently viewed items.
Every time the user interacts with the site, another document is sent to the
browser, containing the same mixture of boilerplate and data. The browser dutifully
throws the old document away and displays the new one, because it is dumb
and doesn’t know what else to do.

"Every time the user interacts with the site, another document is sent to the
browser, containing the same mixture of boilerplate and data. The browser dutifully"

May someone give me example about this?

when We use GET method I know we pass data to URL ,Then Why we need to send boilerplate?why do we need to send HTML?

What is running in AJAX "asynchronous"?Which part are runing "asynchronous"?May someone make it clear by an example?

Re: getdata()

the server will return an XML file. Typically, you (the developer of the server side script) will DEFINE how the XML is constructed. This makes it a boilerplate. The receiving code will ALWAYS receive the exact same structured XML document. although the data contained within the document might change, the XML structure will always be the same (boilerplate template).

so by this example, I "could" say the boilerplate is (in this instance) simply the STRUCTURE of the XML document.
eg:

Re: getdata()

appending the &sid='+Math.Random() will place a random number at the end of the 'get' request. that makes it seem like a 'unique' url request, and will ensure you always receive a new response from the server (refreshed) rather than your browser displaying a cached response.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.