I would like to know if I can send html elements attributes (like id
, class
or title
) with a classic post form
and save them in a db.
I know this is possible with AJAX
, saving the values in variables with javascript and then sending them to a PHP file with $.post
or $.ajax
But is it possible with a normal post submit form?
Thanks to all
This is not possible. Only the value- and the name-attribute are sent to the server when you use a classic submit. There is no way to get more attributes then these two. So, you are forced to use javascript.
The following might be an alternative to your proposed $.post-function: you can adjust a form and then submit it using javascript. So, apart from the two JQuery-functions you mention, there is also a form.submit() method. You will have to manipulate the value- and name-attribute of the form-elements and then use .submit() to send those to the server.
这是不可能的,仅会发布名称和值。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.