0

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

$(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);
});
});
});
4

2 回答 2

0

尝试这个:

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

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

于 2012-09-27T11:28:36.480 回答
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);
    });
    });
    });
于 2012-09-27T11:25:59.967 回答