Jquery AJAX beforeSend function fails IE 8

Im new to jquery and I am stuck. This page works perfectly in Firefox and Chrome but at the beforeSend function in IE8 I always get “All Fields are required” no matter what I do. Can someone point out to me what IE is doing to always cause this function to fail? Thanks. $(document).ready(function() function getQueryParams(qs) …

via HTML Language Development » Search Results » ajax:

Jquery AJAX beforeSend function fails IE 8

Im new to jquery and I am stuck. This page works perfectly in Firefox and Chrome but at the beforeSend function in IE8 I always get “All Fields are required” no matter what I do. Can someone point out to me what IE is doing to always cause this function to fail? Thanks.




Add an Item







Note: If I remove that function then everything works great in IE. It submits to the database and gives me the success messages I’m looking for. Not sure what it is about this function.
……………………………………….

Try changing your validation part as follows.
if (item_num == ” || descript == ” || quanti == ” || fdaa == ”)
$(‘#output’).html(‘All fields are required’);
return false;

there is not need of using [0] for the strings.
……………………………………….

success is called on correct execute (i.e. status 4 OR status “complete”). Use the error for error handling…
$.ajax(
type: ‘POST’,
url: ‘item_add.php’,
data: $(‘form’).serialize(),
dataType: ‘json’,
beforeSend: function()
var item_num = $(‘#item_num’).val();
var descript = $(‘#descript’).val();
var quanti = $(‘#quanti’).val();
var fdaa = $(‘#fdaa’).val();
if (!item_num[0]
},
success: function(response)

$(‘#formcont’).html();

,
error: function(status, errorText)

$(‘#output’).html(response.errorText);

});
In other cases when you seek more control on a lower level you can use:
complete(jqXHR, textStatus)
as follows…

complete: function(req, status)
..
..

For more info: Jquery AJAX beforeSend function fails IE 8

HTML Language Development » Search Results » ajax

Jquery AJAX beforeSend function fails IE 8

Share this post:

Related Posts

Leave a Comment