In website Background Development, form submission is the most basic and core function. In the face of its single submission form and single return form features, if integration is successful, in this case, both the development boss and the development experience in the background will be qualitatively improved.
This method is a piece of content that I have taken from the project. The ajax submission method is used. Please modify it a little.
My development environment is Symfony;
Simple description
Type: ajax submission method get post
Url: submitted address
# FROM submission form ID
$ ("# FROM"). serialize ()
[Serialize () for the core method, jquery method, predict more please learn] http://www.w3school.com.cn/jquery/ajax_serialize.asp
/**
* Ajax submission
*
* @ Param type
* @ Param url
*/
Function ajaxSubmit (type, url)
{
JQuery. ajax ({
Type: type,
Url: url,
Data: $ ("# FROM"). serialize (),
DataType: 'json ',
Success: function (data ){
Alert (data. message );
If (data. errorCode = 0 | data. errorCode = 5 ){
Window. location. href = data. data. go_url;
}
}
})
};