如何将参数传递给Jquery $ .Getjson方法? [英] How Can I Pass Parameters To A Jquery $.Getjson Method?

查看:78
本文介绍了如何将参数传递给Jquery $ .Getjson方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是jquery的新手。我正在尝试使用JQuery通过Ajax / $。getJSON调用控制器的某些操作。我正在尝试将自定义值传递给Ajax回调方法,但这没有执行。我使用调试器但没有收到错误。这是我的代码: -

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使用调试器但不在函数(数据)中执行。



谢谢


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

Thanks

推荐答案

.getJSON。我正在尝试将自定义值传递给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 ;
.getJSON("/Search/SearchResultsJson/?sub=" + sub + "&code=" + code + "&callback=?", function (data) { debugger; alert('result') setupDone = true; fetching = false;


#mapOverlay)。hide();
("#mapOverlay").hide();


这篇关于如何将参数传递给Jquery $ .Getjson方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆