serializeobject jquery
var datastring = $("#contactForm").serialize();
$.ajax({
type: "POST",
url: "your url.php",
data: datastring,
dataType: "json",
success: function(data) {
//var obj = jQuery.parseJSON(data); if the dataType is not specified as json uncomment this
// do what ever you want with the server response
},
error: function() {
alert('error handling here');
}
});$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
Also in JavaScript:
- remove a user from a reaction discord.js
- node check if running on localhost?
- reactjs facebook login popup trigger on load page
- npm err! 503 service unavailable proxy
- how to generate a random number between 1 and 6 in javascript
- core.js:6228 ERROR TypeError: Cannot read property 'image' of undefined
- js function
- mongoose bulk update
- jquery dropdown select
- finding the smallest number in an array javascript
- error: Error: Unable to resolve module `react-native-gesture-handler` from `node_modules\@react-navigation\native\lib\module\Scrollables.js`: react-native-gesture-handler could not be found within the project.
- generate random color jquery
- useRef() in react
- $.notify is not a function angular
- javascript for loop over dictionary
- extract all link with javascript
- javascript random number generator
- jquery siblings
- change id in jquery
- python dictionary to json
- cordova load javascript without cache
- node js http request get parameters
- javascript iterate object
- spam system discord.js