You're having this issue because funBegin
is called after the form data has been serialized. From MSDN:
AjaxOptions.OnBegin Property: Gets or sets the name of the JavaScript function to call immediately before the page is updated.
I suggest you write your own submit handler:
<form id="myform" action="/Home/MyAction">
<input type="text" id="txtName" name="txtName" value="gaurav" />
<input type="submit" value="Submit" />
</form>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#myform').submit(function() {
$("#txtName").val("gaurav pandey");
var form = $(this);
var url = form.attr('action');
var formData = form.serialize();
$.post(url, formData, function(result) {
// Do something with result
});
return false;
});
});
</script>
sheikhomar
2010-10-31 12:52:25