Page.ResolveUrl not working in javascript
Hi Guys,
I pass back a reference to an image in json format from a web handler. This is from my contentpage called Profile.aspx
Code:
$('#fileupload').fileupload({
replaceFileInput: false,
formData: function (form) {
return [{ name: "txtFirstName", value: $('#txtFirstName').val() }, { name: "txtLastName", value: $('#txtLastName').val()}];
},
dataType: 'json',
url: '<%= ResolveUrl("ProfileImageHandler.ashx") %>',
done: function (e, data) {
$.each(data.result, function (index, file) {
alert($('#imgProfile'));
alert(file);
$('.imgProfile').attr('src', '<%= Page.ResolveUrl("' + file.toString() + '") %>');
});
}
});
});
so my file variable will be something like ~Profile/Images/Image1.jpg
Using page.ResolveUrl isn't working:( this is what the src gets set to if I pass the above path:
Code:
src="/localhost/Profile/~/Profile/Images/big_evil.jpg"
what am i doing wrong. Please help