Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I m new to jquery. I'm trying to use JQuery to call some action of controller by Ajax/$.getJSON . I'm trying to pass a custom value into the Ajax callback method, but this not executed. I use debugger but not getting error. This is my code:-
C#
function getAllRecords(sub,code) {
  fetching = true;
  $.getJSON("/Search/SearchResultsJson/?sub=" + sub + "&code=" + code + "&callback=?", function (data) {
      debugger;
      alert('result')
      setupDone = true;
    fetching = false;
  
    $("#mapOverlay").hide();
    $("#loadingLabel").hide();

    if (firstSearch) {
      distanceWidget = new DistanceWidget({
        map: map,
        distance: 1, // Starting distance in km.
        maxDistance: 4, // Twitter has a max distance of 2500km.
        color: '#000000',
        activeColor: '#5599bb',
        sizerIcon: 'Images/resize-off.png',
        activeSizerIcon: 'Images/resize.png'
      });

i use debugger but it not executed inside function(data).

Thanks
Posted
Updated 21-Apr-16 21:41pm

Try this,
$.getJSON("/Search/SearchResultsJson?sub=" + sub + "&code=" + code + "&callback=?", function (data)

-KR
 
Share this answer
 
Comments
ErBhati 3-Nov-15 0:40am    
I already try this . This not helps me.
I found the solution. After removing callback.
C#
$.getJSON("/Search/SearchResultsJson?sub=" + sub + "&code=" + code + "", function (data) 
 
Share this answer
 
This is also a way
var valdata = {
sub: sub,
code:code

};
JavaScript
$.getJSON("/Search/SearchResultsJson/", valdata, function (data) {
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900