I know the question i've posted here is quit silly but after hours of googling and trying all most everything i could not get the desired result. So let me share it here in a hope to get solved here.
My problem is, i've an Image url source where i need to change Image name with new image name everytime. I'll post my tried code:
$(function () {
//Old Image Url where i need to change 32_Penguins.jpg with new file name
var ImageSrcUrl="../Upload\UserProfile\32_Penguins.jpg"; //Don't change forward slash with backword slash here and then try to answer
var NewFileName="Tullips.jpg";
//I tried to replace everything after the last "\"[slash]
ImageSrcUrl= ImageSrcUrl.replace(/.*$/i, NewFileName);
alert(ImageSrcUrl);
});
Note: Please don't try to replace forward slash with backward slash manually and then answer it[Bcoz it works but conversion should be done via jquery code not manually]