Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sample1 = "aaa";
- var sample2 = "bbb";
- $.ajax({
- url: "Action/Controller",
- data: $("#form123").serialize(),
- cache: true,
- type: "POST",
- dataType: 'html',
- success: function (data) {
- $('#form123').html(data)};
- });
- data: {
- formData: $("#form123").serialize(),
- sample1: sample1,
- sampleTwo: sample2
- }
- var formData = $("#form123").serialize() + '&' + sample1 + '&' + sample2;
- $.ajax({
- ...
- data: formData,
- ...
- });
- $.ajax({
- url: "Action/Controller/" + sample1 + "/" + sample2,
- data: $("#form123").serialize(),
- cache: true,
- type: "POST",
- dataType: 'html',
- success: function (data) {
- $('#form123').html(data)};
- });
- @using(Ajax.BeginForm("Action", "Controller", new {@param1 = "aaa", @param2 = "bbb"}, new AjaxOptions(){HttpMethod = "Post", UpdateTargetId = "#section1"})){
- <div id="#section1">
- ..... put your form controls here . . .
- </div>
- }
- public PartialViewResult Action(string param1, string param2, ViewModel model)
- <input type="hidden" id="var1" name="var1" value="@sample1" />
- <input type="hidden" id="var2" name="var2" value="" />
- $('#var2').val(var2); //before sending your form of course!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement