websss
asked on
mvc ajax call breaks when published to virtual directory - url.action?
My MVC app works great locally, but when i publish into a virtual directory it calls the wrong path
I.e. instead of
Localhost/virtual/Home/Plo tProbeData
it calls
Localhost/Home/PlotProbeDa ta
Here is the piece of code in question
i've looked online and it suggests using url.content or url.action, but what I tried doesn't seem to work
the above code exists inside the cshtml file.
I.e. instead of
Localhost/virtual/Home/Plo
it calls
Localhost/Home/PlotProbeDa
Here is the piece of code in question
$.getJSON("/../Home/PlotProbeData", { probe: probeData }, function (data) {
i've looked online and it suggests using url.content or url.action, but what I tried doesn't seem to work
the above code exists inside the cshtml file.
Is your controller called VirtualController?
ASKER
No it's called home
The virtual directory is called virtual
The virtual directory is called virtual
Guessed that much. Did you play around with ~ in URL?
ASKER
no i haven't tried that yet
Try
$.getJSON("~/../Home/PlotProbeData", { probe: probeData }, function (data) {
ASKER
looks like that will work when released, however when in debug mode it goes to
Localhost/Home/Home/PlotPr obeData
instead of
Localhost/Home/PlotProbeDa ta
Localhost/Home/Home/PlotPr
instead of
Localhost/Home/PlotProbeDa
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.