如何通过AJAX传递GET数据和POST数据[关闭]

I have a small form I'd like to validate with AJAX. (I'm using jQuery)

I'd like to pass the data entered in the inputs by the user (POST method) and some other data that is typically available in my controller/view.

How can I do that?

Thanks

GET data goes in the URL

 /controller/action?name=will&last_name=smith

POST data travels in the request body, in several ways form-data, xml, json, etc

Maybe you should try to POST the first url with your request body data

just include GET-data into the URL, e.g. http://www.example.com?param=value

and use POST for the rest

you can include the data you want to send in a hidden form field, on the controller process the post request, then redirect to get