Home > Backend Development > PHP Tutorial > ajax.call是什么意思?解决方案

ajax.call是什么意思?解决方案

WBOY
Release: 2016-06-13 13:10:16
Original
1210 people have browsed it

ajax.call是什么意思???

 ajax.call是什么意思?解决方案 {$link.link_id}
这段代码调用了listTable.toggle函数

listTable.toggle = function(obj, act, id)
{
  var val = (obj.src.match(/yes.gif/i)) ? 0 : 1;

  var res = Ajax.call(this.url, "act="+act+"&val=" + val + "&id=" +id, null, "POST", "JSON", false);

  if (res.message)
  {
  alert(res.message);
  }

  if (res.error == 0)
  {
  obj.src = (res.content > 0) ? 'images/yes.gif' : 'images/no.gif';
  }
}

这里的/yes.gif/i的i是干嘛用的,还有ajax.call是什么意思???



------解决方案--------------------
ecshop?
var res = Ajax.call(this.url, "act="+act+"&val=" + val + "&id=" +id, null, "POST", "JSON", false);
这是封过的一个方法,根据参数可知
this.url为请求url
中间act=&...这都是传的参数
POST方式,返回JSON类型
null和false可能是设置回调函数

(obj.src.match(/yes.gif/i)) ? 0 : 1;
这是三目运算符,在对象src属性里查yes.gif
/i是不区分大小写,属正则表达式内容
作用是,若src内有yes.gif返回0否则1
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template