Reference files from javascript

Discussion in 'Site Programming, Development and Design' started by DavidLJ, Apr 2, 2012.

  1. I have rewritten my application for MVC. I have some javascript where I reference image files as object properties (actually icons for markers in GoogleMaps).

    In the development site, I accessed them as
    icon: "/Content/Images/Course/Flag1.png"

    I have now deployed to Winhost, where the application is hosted in a subdirectory of the root - and broken the link. The javascipt source is in an external .js file. I have tried

    icon: '@Url.Content("~/Content/Images/Course/Flag1.png")'

    but this does not work. How do I use an HTML helper, so that I do not have to hard code the route?
     
    Last edited by a moderator: Oct 14, 2015

Share This Page