The Easiest Way to Save and Share Code Snippets on the web

Jquery AJAX - submit return true?

javascript

posted: Jun, 30th 2012 | jump to bottom

	$('#add_form').submit(function (e) {
		//e.preventDefault();
		$.ajax({
			async: false,
			type: 'POST',
			url: '/?eID=r_productsmanager',
			data: {
				'serial_number': $('input[name="tx_rproductsmanager_pi1[serial_number]"]').val(),
			},
			dataType: 'json',
			success: function(result) {
				if (result.snResult != true) {
					e.preventDefault();
					alert(result.snResult);
				}
			}
		});
	});
75 views