File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Passing parameter in ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Passing parameter in ajax" Watch "Passing parameter in ajax" New topic

Passing parameter in ajax

Adrian Perry
Ranch Hand

Joined: Jul 21, 2005
Posts: 42

In our project we are using Ajax. We have set up a div using Ajax and load this div with various html files. The rest of the page remains same, only the div element which load html pages keeps changing, relative to the html pages being called. Now in this html file I have many textfields, whose value I want to pass to another page. I have achieved this but I want a better soln.

I am using javascript to pass and retrive values. I pass the textfield values to a global javascript files and retrive the values on another page from this global file. I am calling a function in javascript on submit button and getting all the textfield values.

I would like to know is a way i can pass the values from one page to another without involving global.js file, just like we do in jsp files.(eg request.getParameter()). Also how do I post the data in Ajax. ie. is there a way of posting data in Ajax.

Another query I have is : if my html files have some javascripting in it, it is never called, the scripting has to be present only in one place ie global.js, why is this and why cant I have scripting in every html pages.

Your contribution will be greatly appriciated.
[ November 21, 2006: Message edited by: Bear Bibeault ]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Any basic tutorial on the XMLHtpRequest shows how to post with the send() method.

I agree. Here's the link:
subject: Passing parameter in ajax
It's not a secret anymore!