3 ms·
In your example, you'll also need to change the headers because $.ajax will set content type to application/json, which wouldn't work if your server is setup to
by jbob2000 9y ago
In your example, you'll also need to change the headers because $.ajax will set content type to application/json, which wouldn't work if your server is setup to receive x-www-form-urlencoded or multipart/form-data.
Starting to get complicated now, might be easier to just do $("#form").submit().
- wongarsu 9y agoright, forgot to change the header. Sure, it's more complicated than $("#form").submit(). But it's close enough that other considerations become more important (e.g. do I want a page reload, do I have to populate the form first etc)