ajax如何获取a标签的内容,如何获取ajax页面的网址?

我对ajax非常陌生,并将它成功应用于Drupal站点。但我想知道,我怎样才能得到一个页面的URL,其中一部分内容是通过ajax加载的。这甚至有可能吗? JSON对象是通过点击来检索的,那么如何在检索某个URL时使其工作? 我意识到这是一个非常广泛的问题,任何帮助将不胜感激。 在此先感谢!如何获取ajax页面的网址?

我的JS是这样的:

Drupal.behaviors.ajax_pages = function (context) {

$('a.categoryLink:not(.categoryLink-processed)', context).click(function() {

var updateProducts = function(data) {

// The data parameter is a JSON object. The films property is the list of films items that was returned from the server response to the ajax request.

if (data.films != undefined) {

$('.region-sidebar-second .section').hide().html(data.films).fadeIn();

}

if (data.more != undefined) {

$('#content .section').hide().html(data.more).fadeIn();

}

}

$.ajax({

type: 'POST',

url: this.href, // Which url should be handle the ajax request. This is the url defined in the html tag

success: updateProducts, // The js function that will be called upon success request

dataType: 'json', //define the type of data that is going to get back from the server

data: 'js=1' //Pass a key/value pair

});

return false; // return false so the navigation stops here and not continue to the page in the link

}).addClass('categoryLink-processed');

}

2010-09-07

Eelke

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值