Home

Published

- 1 min read

jquery ajax type json

img of jquery ajax type json

The solution for this is noted below

jquery ajax type json

Solution

   $.ajax('/jquery/submitData', {
	type: 'POST', // http method
	data: { myData: 'This is my data.' }, // data to submit
	dataType: 'json',
	success: function (data, status, xhr) {
		$('p').append('status: ' + status + ', data: ' + data)
	},
	error: function (jqXhr, textStatus, errorMessage) {
		$('p').append('Error' + errorMessage)
	}
})

Try other methods by searching on the site. That is if this doesn’t work