对于类型函数jquery,函数get(String,any,Function)是未定义的

时间:2012-09-27 11:19:25

标签: jquery get

我不明白我的代码有什么问题,因为我在很多教程中都看到了同样的问题。请帮助....这是代码:

$(document).ready(function() {
$('#div').click(function() {
type: 'POST';
String url= 'fivepluscms/client/CMSGallery.jsp';
String data = $('a').attr('id');
String equalPosition = data.indexOf('='); //Get the position of '='
String number = data.substring(equalPosition + 1);
$.get(url, number, function(raspuns){
  $('#div class="ngg-gallery-thumbnail"').html(raspuns);
});
});
});

2 个答案:

答案 0 :(得分:0)

试试这个..

$(document).ready(function() {
         $('#div').click(function() {

           var url= 'fivepluscms/client/CMSGallery.jsp';
           var data = $('a').attr('id'); //means the id of the first 'a' //probably incorrect
           var equalPosition = data.indexOf('='); //Get the position of '='
           var number = data.substring(equalPosition + 1);

           $.get(url, number, function(raspuns){
              $('div.ngg-gallery-thumbnail').html(raspuns);
    });
    });
    });

答案 1 :(得分:0)

试试这个:

$.get(url, { number: number }, function(raspuns){
  $('.ngg-gallery-thumbnail').html(raspuns);
});

你的问题是,当需要时,第二个变量不是数组。你可以在这里看到:http://api.jquery.com/jQuery.get/