What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 15960 |  Welcome, Guest!   Register  Login
 Home > Forums > jQuery > Not able to invoke jquey Ajax method for fileupload input value ...
Santosh.Impossible

Not able to invoke jquey Ajax method for fileupload input value

Replies: 0 | Posted by: Santosh.Impossible on 4/25/2012 | Category: jQuery Forums | Views: 428 | Status: [Member] | Points: 10  


I am trying to invoke the serverside method from the jquery. It is working fine in FireFox but not in IE8 and IE9.

Please find the below code sample :
<div>
<asp:FileUpload ID="flAppIcon" runat="server" onchange="GetFileSize();"/>
<asp:HiddenField ID="_hdnAppIcon" runat="server" Value="0" />
</div>

<script type="text/javascript" language="javascript">
function GetFileSize() {
var PageURL = '<%= ResolveUrl("~/WebForm16.aspx") %>'
var test = ($('#<%=flAppIcon.ClientID%>').val()).toString();
$("#<%=_hdnAppIcon.ClientID%>").val(test);
alert($("#<%=_hdnAppIcon.ClientID%>").val());
$.ajax({
type: "POST",
url: PageURL + '/GetFileSizeDetails',
data: '{file: "' + $("#<%=_hdnAppIcon.ClientID%>")[0].value + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
}
});
}
function OnSuccess(response) {
alert(response.d);
}
</script>
[System.Web.Services.WebMethod]
public static string GetFileSizeDetails(string file)
{
return "100";
}
Can anyone help me to know the root cause of this issue.

Thanks & Regards,
Santosh Kumar Patro

santosh kumar patro


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

  No reply found.


Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 12:51:35 PM