Save a form in an XML file using Ajax and JSP

Posted by novellino on Stack Overflow See other posts from Stack Overflow or by novellino
Published on 2010-04-19T11:42:35Z Indexed on 2010/04/19 11:43 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

Hello, I want to create a simple form with a name and an email and save these data in an XML file. So far I found that using Ajax with jQuery is quite easy. So I used the usual code:

//dataString have the values taken from the form
var dataString = 'name='+ name + '&email=' + email;
$.ajax({
 type: "POST",
 url: "users.xml",
 data: dataString,
 dataType: "xml",
 success: function() { .... }
});

If I understood well, in the url I should add the name of the XML file that will be created.

When the user clicks a button I call the function with the Ajax request, and then I should call somewhere a function for generating the xml.

I am using also two beans. One is for setting the elements of the user and the other is for saving the data in the XML. I am using the XStream library for the xml although I don't know if is the best solution.

The problem now it that I can not connect all these together in order to save the data in the XML.

Does anyone know what should I do?

Thanks a lot!

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about jQuery