无缓存,无错版 $.ajax({ type: GET, url: index.php, cache: false, data: con=Addact=_searchkey= + key+id=+id, dataType:json, success: function(msg){ bindGroupList(msg); } }); //绑定 function bindGroupList(result) { var eles = document.forms[
无缓存,无错版
$.ajax({
type: "GET",
url: "index.php",
cache: false,
data: "con=Add&act=_search&key=" + key+"&id="+id,
dataType:"json",
success: function(msg){
bindGroupList(msg);
}
});
//绑定
function bindGroupList(result)
{
var eles = document.forms['theForm'].elements;
eles['group_id'].length = 1;
for (i = 0; i {
var opt = document.createElement('OPTION');
opt.value = result.content[i].id;
opt.text = result.content[i].name;
eles['group_id'].options.add(opt);
}
}
会缓存
$.getJSON("?con=Add&act=_search&key=" + key+"&id="+id, function(data){
//bindGroupList(data)
});
=====php make_json_result=======
/**
* 创建一个JSON格式的数据
*
* @access public
* @param string $content
* @param integer $error
* @param string $message
* @param array $append
* @return void
*/
function make_json_response($content = '', $error = "0", $message = '', $append = array()) {
$res = array(
'error' => $error,
'message' => $message,
'content' => $content
);
if (!empty($append)) {
foreach ($append AS $key => $val) {
$res[$key] = $val;
}
}
$val = json_encode($res);
exit($val);
}
/**
*
*
* @access public
* @param
* @return void
*/
function make_json_result($content, $message = '', $append = array()) {
make_json_response($content, 0, $message, $append);
}
return make_json_result($list);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download
The most popular open source editor
