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

数字战争

数字战争

[英]查尔斯·亚瑟 / 余淼 / 中信出版社 / 2013-6-1 / 49

1998年,数码世界初具雏形。 至此以往,大浪淘沙。随着IT产业的迅猛发展,涌现出了以苹果、谷歌、微软为首的行业巨头。它们为争夺数码世界不同分支的霸主地位而争斗,包括搜索技术、移动音乐、智能手机和平板电脑市场。它们可利用的武器包括硬件、软件以及广告。同时,它们要赌上的则是公司的声望,当然,还有我们的未来。然而,无论在产品创新还是在战略优势上,这些企业彼此竞争、彼此砥砺,推动了行业的良性发展。......一起来看看 《数字战争》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具