Using jquery to make a POST, how to properly supply 'data' parameter?

后端 未结 5 703
生来不讨喜
生来不讨喜 2020-11-30 11:01

I\'d like to make an ajax call as a POST, it\'s going to go to my servlet. I want to send parameterized data, like the following:

var mydata = \'param0=some_         


        
5条回答
  •  悲&欢浪女
    2020-11-30 11:55

    If you have a form, you can also do var data = jQuery("#myForm").serialize(); which puts it in a form that jQuery.ajax can understand and use. Otherwise, use the object literal described in Nick's answer.

提交回复
热议问题