c# - Compare Models before and after submission -
i having view accepts model
@model mymodel
now want serialize model using jquery , store in 1 global variable.
now @ time of submission of form want again serialize model. models value might have changed . want latest serialized model compared old model stored in variable. there way compare these models in single line , depending on submit form.
code
$(document).ready(function(){ var oldmodel=$('form').serialize(); $('form').submit(function(){ var newmodel=$('form').serialize(); if(oldmodel==newmodel)//how can achieve this? e.preventdefault(); }); })
no, none i'm aware of. you'll have write separate function compares each , every field value before submission.
Comments
Post a Comment