0

The HTML for jqueryUI tabs.

<div id="lodg_tabs" class="tabs">
    <ul>
        <li><a href="#tabs-1">Add/Remove</a></li>
        <li><a href="mand_lodg_upd.aspx">Update</a></li>
    </ul>
    <div id="tabs-1" class="forms">
        <h3 align="center">Mandate Lodgment</h3>
        <form name="mand_lodg" id="mand_lodg" method="post"> 

ajax code to send parameters to the tab loading "mand_lodg_upd.aspx"

$("#lodg_tabs").tabs({
    select: function (event, ui) {
        var res = valid('mand_lodg');
        $(this).tabs("option", { ajaxOptions: { data: $("#mand_lodg").serialize()} });
     },
     ajaxOptions: {
         type: 'POST',
         error: function (xhr, status, index, anchor) {
             $(anchor.hash).html("An error has been encountered while attempting to load this tab.");
         }
     },
     cache: false
});

the c# code behind

Response.Write(Request.Form["zone"] + Request.QueryString["zone"]);
            zone.Value = Request.Form["zone"];
            loc.Value = Request.Form["loc"];
            date.Value = Request.Form["date"];

The output: Output is ok, the file is loading in the tab

The problem : but the parameters passed with ajax i.e

$(this).tabs("option", { ajaxOptions: { data: $("#mand_lodg").serialize()} });

zone location and date are null in c# code behind

1 Answer 1

1

Request.Form is referring to HTTP request parameters via the POST method. JQuery by default issues a GET method request. Try setting your AJAX Options like so:

$(this).tabs("option", { 
    ajaxOptions: { 
                   type: 'post', 
                   data: $("#mand_lodg").serialize()
                 } 
});
Sign up to request clarification or add additional context in comments.

4 Comments

Request.QueryString["zone"] is also giving null then. I hope QueryString is to extract from get method.
Request.QueryString should work. Can you provide the form to your code above... are you setting the name attribute of the elements you are posting?
Request.QueryString was not working anyhow the above ans helped, I kept type as post. thankyou. Still I would like to know y Request.QueryString is not working :)
Reviewing some code, to send the querystring I believe you have to set the AJAXOption 'url'. So it would be { url: '[webpage]?' + $("#mand_lodg").serialize()}. The AJAXOption 'data' only sends when you POST to the server, but you can always use Request.QueryString to parse the requested url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.