Click here to Skip to main content
14,326,246 members
Rate this:
Please Sign up or sign in to vote.
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:-
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

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

-KR
   
Comments
ErBhati 3-Nov-15 0:40am
   
I already try this . This not helps me.
Rate this:
Please Sign up or sign in to vote.

Solution 2

I found the solution. After removing callback.
$.getJSON("/Search/SearchResultsJson?sub=" + sub + "&code=" + code + "", function (data) 
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

This is also a way
var valdata = {
sub: sub,
code:code

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

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100