Monday, March 18, 2013

Jquery Ajax Function Code

  $.ajax({
  type: "POST",
  url: "Bookresponse.jsp",
  data: { category:document.book.category.value,
Title:document.book.Title.value,
Author:document.book.Author.value,
Publication:document.book.Publication.value,
Edition:document.book.Edition.value,
Noofcopies:document.book.Noofcopies.value,
Volume:document.book.Volume.value,
Datepur:document.book.Datepur.value,
Price:document.book.Price.value
}
  })


Place the above function inside   $('#exm').on('submit', function(e) {    and      }.

exm is the id of the form which is to be submitted and on clicking on submit, data is submitted to Bookresponse.jsp file.
Each input element data is passed through by using form name and element name.Book is the form name and category is the input element name.

In Bookresponse.jsp file,each value is retrieved .For example,String str=request.getParameter("category");

1 comment: