javascript - Jquery ajax validate or not? -
i'm using code execute action in controller parameters. , working in validation of inputs.
$('.txt-dtr').on('blur', function () { // record type know column of table should value saved. var record = $(this).attr('id'); // record value var value = $(this).val(); // record date var row = $(this).closest('tr'); var date = row.attr('id'); // employee id var empid = $('#semployee').val(); // ajax script saving record $.ajax({ type: 'post', url: '/dtr/savedtr', data: { record: record, value: value, date: date, empid: empid } }); });
this code works, onblur
, did'nt type in txt-dtr
value
parameter null , ajax not execute (which want).
the question is, need write validation like
if(value != null){ //execute ajax }
or leave because without validating ajax not execute?
edit:
my controller not accepting null values ajax not executed if has null parameter value.
public actionresult savedtr(string record, int value, datetime date, int empid) {
yes needs ajax wont validate. send null value
Comments
Post a Comment