AjaxFilter

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-11 09:12:44

软件介绍

This tiny plugin provides a registry for different filter functions to sanitize ajax responses.
It requires jQuery 1.3 with its new feature, the 'dataFilter' ajax setting.

If you want to provide a new implementation, you need to do something like this:

jQuery.ajaxFilter.register( 'js_in_href', 'html', function( data ){
     return data.replace(/href="javascript:[^"]+"/g, '');
});

or
jQuery.ajaxFilter.register('eval', 'script html json', function( data ){
     return data.replace(/eval\(.+?\);?/g, '');
});

Arguments for jQuery.ajaxFilter.register() are:

  1. Name for the filter, used as 'filter' when calling jQuery.ajax.
  2. One or more dataTypes to handle. Can be any combination of ajax, html, json and xml separated by spaces.
  3. The filter function. Will receive 2 arguments: the data and the type. The 'this' will reference the settings object.

To use it, you do:

jQuery.ajax({
     url:'foo.html',
     filter:'js_in_href',
     // ...
});

The filter can also parse the response.
That means it can (for example) provide an alternative way of eval'ing json. This is specially useful for Adobe AIR apps.
If the filter returns something else than a string, it's assumed to be the final response.

本文地址:https://codercto.com/soft/d/23129.html

随意搜寻

随意搜寻

Peter Morville / 沈浩翔 / 华中科技大学出版社 / 2013-10-1 / CNY 68.00

在这个信息爆炸的年代,我们如何找到出路?在纷繁交错的信息流中,我们如何筛选出想要的信息?既然Google已经魔法般地将正确答案呈现在我们面前,为什么信息架构的方式依然重要? 《Web信息架构》的作者Peter Morville,用了10年时间回答以上问题。《随意搜寻》是 一趟奇妙的旅程,让未来触手可及:无论何时何地,我们都能找到任何人、任何东西。这本书即是路线图,也是信息时代的“玛雅预言”,......一起来看看 《随意搜寻》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具