Load ascx via jQuery

Posted by Raika on Stack Overflow See other posts from Stack Overflow or by Raika
Published on 2011-01-04T18:36:58Z Indexed on 2011/01/04 20:54 UTC
Read the original article Hit count: 174

Filed under:
|
|

Is there a way to load ascx file by jQuery?

UPDATE:

thanks to @Emmett and @Yads.i am use the handler and the ajax:

 jQuery.ajax({
    type: "POST",  //GET
    url: "Foo.ashx",
    data: '{}',
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response)
    {
        jQuery('#controlload').append(response.d); // or response
    },
    error: function ()
    {
        jQuery('#controlload').append('error');
    }
 });

but i,m just getting an error. my ajax is wrong?

Another Update : i am using

error: function (xhr, ajaxOptions, thrownError)
{
    jQuery('#controlload').append(thrownError);
}

and this what i get :

Invalid JSON:
Test =>(this test is label inside my ascx)

and my ascx file after Error!!!

Another Update :

my ascx file is somthing like this:

<asp:DropDownList ID="ddl" runat="server" AutoPostBack="true">
    <asp:ListItem>1</asp:ListItem>
    <asp:ListItem>2</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server">Test</asp:Label>

but when I call ajax i get this error in asp: :(

Control 'ctl00_ddl' of type 'DropDownList' must be placed inside a form tag with runat=server.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery