Can anyone tell me how can I submit values to Controller using ActionLink and POST method?
I don't want to use buttons.
I guess it has something with jquery.
Thank you!
views:
1219answers:
3
A:
http://docs.jquery.com/Ajax/jQuery.post will work if you have custom data. If you want to post existing form, it's easier to use ajaxSubmit from http://jquery.malsup.com/form/#api.
And you don't have to setup this code in the ActionLink itself, since you can attach link handler in the document.ready event (which is a preferred method anyway), for example using $(function(){ ... }) jQuery trick.
queen3
2010-01-12 12:37:10
+1
A:
You can't use an ActionLink because that just renders an anchor tag.
You can use a JQuery AJAX post, see http://docs.jquery.com/Ajax/jQuery.post
or just call the form's submit method with or without JQuery (which would be non-AJAX), perhaps in the onclick event of whatever control takes your fancy.
AUSteve
2010-01-12 13:23:55