My issue is for some strange reason it seems stuck in the page controller so instead of getting out and going into the ajax controller I have it trying to go down that route in the page controller
1st try
http://localhost:2185/Alpha/Ajax/GetBlah_Name/?lname=Ge&fname=He
2nd try
http://localhost:2185/Patient/~/Ajax/GetBlah_Name/?lname=Ge&fname=He
Objective
http://localhost:2185/Ajax/GetBlah_Name/?lname=Ge&fname=He
Page button to call jquery
<a style="margin-left: 310px;" href="javascript:void(0)" onclick="getBlah()"
class="button"><span>Lookup</span></a>
Jquery code
1st try
{
$.getJSON(callbackURL + 'Ajax/GetBlah_Name/?lname=' + $('#Surname').val() + '&fname=' + $('#FirstName').val(), null, GetResults)
}
2nd try
{
$.getJSON(callbackURL + '~/Ajax/GetBlah_Name/?lname=' + $('#Surname').val() + '&fname=' + $('#FirstName').val(), null, GetResults)
}
In summary I don’t know why it won’t break out of the controller and go into the Ajax controller like it has done so in all the other projects I’ve done this in using the 1st try solution.
It seems you want to cal a controller at ~/Ajax. Is it? If yes, you should use this code:
UPDATE:
This will work for your Q, but the complete solution is @Darin Dimitrov‘s answer. I suggest you to use that also.
UPDATE2
~is a special character that just ASP.NET works with it! Sohttpdoesn’t understand it. and if you start yoururlwith a word -such asAjax-, theurlwill be referenced from where are you now (my english is not good and I can’t explain good, see example plz). For example, you are here:when you create a link in this page, with this
href:that will be rendered as
But, when
urlstarts with/, you are referring it to root of site:will be:
Regards