Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

send a form data using ajax

 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Report post to moderator
how will send a form data using ajax.
when i click submit button request is not going at server.
i want to send request using data.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
It's be much easier, and a lot more robust, to use jQuery to do your Ajax. it not only makes the Ajax calls easier, it can gather the form data for you.

P.S. When you post code, make sure that it is properly indented.
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Report post to moderator
Bear Bibeault wrote:It's be much easier, and a lot more robust, to use jQuery to do your Ajax. it not only makes the Ajax calls easier, it can gather the form data for you.

P.S. When you post code, make sure that it is properly indented.



sorry Bear i don't know JQuery.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
You didn't know Java at one time either. Practically no one does Ajax "by hand" these days. There are too many nuances and pitfalls. If you are serious about your craft, you need to continue to learn new things and the best way to go about things.

But, if you want to continue on your current path, I'd recommend opening the debugging tools in the browser and stepping through the code to see where it's going awry.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
One of the best reasons for using jQuery is that it smooths out many of the warts in JavaScript. Since JavaScript is notorious for having critical differences between not only browsers, but browser versions, jQuery provides a way for coding more of a "write-once/run-anywhere" script without having to spend a lot of time and effort.
 
Anup Nadig Malathesha
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
Bear Bibeault wrote:It's be much easier, and a lot more robust, to use jQuery to do your Ajax. it not only makes the Ajax calls easier, it can gather the form data for you.

P.S. When you post code, make sure that it is properly indented.


Hi,
I used jQuery to send data from ajax to servlet. It was working fine when I was working on eclipse.
But when I tried to use these code on other server, I am getting 404 error.
I think this error is mainly because of unable to map my servlet class with the URL given in ajax.
I used web.xml in the eclipse but I also copied this file to server but it still not working.
Please help me regarding this.

Thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once.
 
    Bookmark Topic Watch Topic
  • New Topic