On the click of a button I am dynamically adding the following Div to my web page.
The problem is the image source cannot be found due to the incorrect path caused by the backslash just before "\Content". The backslash is already reserved to escape quotes.
How can I workaround this.
$("<div class=\"input-append\"><label style=\"background-color:#e0ffff\">" + artistVal + "</label><img onclick=\"RemoveArtist()\" id=\"removeartist\" src=\"\Content\bootstrap\img\cross-button.png\" /></div>").appendTo(addDiv);
I am getting an error 400 pulling the image added to the div
Request URL:http://myhost:53159/Content%08ootstrapimgcross-button.png
On the click of a button I am dynamically adding the following Div to my web page.
The problem is the image source cannot be found due to the incorrect path caused by the backslash just before "\Content". The backslash is already reserved to escape quotes.
How can I workaround this.
$("<div class=\"input-append\"><label style=\"background-color:#e0ffff\">" + artistVal + "</label><img onclick=\"RemoveArtist()\" id=\"removeartist\" src=\"\Content\bootstrap\img\cross-button.png\" /></div>").appendTo(addDiv);
I am getting an error 400 pulling the image added to the div
Request URL:http://myhost:53159/Content%08ootstrapimgcross-button.png
Share
Improve this question
edited Nov 21, 2013 at 15:04
BenMorel
36.7k51 gold badges205 silver badges336 bronze badges
asked Sep 1, 2013 at 21:12
MilligranMilligran
3,1719 gold badges46 silver badges57 bronze badges
2 Answers
Reset to default 3You can either use double backslashes (\\
) in file paths, or use forward slashes (/
). Using a forward slash is more reliable, since backslashes don't work correctly on all web servers.
Use slash instead of backslash for your src element. This way you avoid the escaping problem inside URLs
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742416134a4439782.html
评论列表(0条)