Is there a way to upload an ascx file using jQuery?
UPDATE
thanks @Emmett and @Yads. I use a handler with the following jQuery ajax code:
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 get an error. Is my code wrong?
Other Update : I am using
error: function (xhr, ajaxOptions, thrownError) { jQuery('#controlload').append(thrownError); }
and this is what I get:
Invalid JSON:
Test => (this test is a label inside my ascx)
and my ascx file after the error !!!
Other Update :
my ascx file looks something 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 ajax is called, I get this error in asp :: (
The ctl00_ddl control of the DropDownList type must be placed inside the form tag using runat = server.
thanks @Yads. but his solution only works with the html tag.
Raika
source share