日期:2014-05-16 浏览次数:20351 次
document.observe('dom:loaded', function(){ $("btnok").observe('click', function(){ clickButton(); }); }); function clickButton() { var url = '/user/info.php'; var pars = "uid=1&r="+Math.random(); var ajax = new Ajax.Request(url,{ method:'get', parameters:pars, onSuccess:function(data) { callbackfunc(data); }, }); } function callbackfunc(data) { console.log(data.responseText.evalJSON()); alert("SUCCESS"); }
$j(document).ready(function(){ $j("#btnok").click(function(){ clickButton(); }); }); function clickButton() { $j.ajax({ url:'/user/info.php', data:{uid:2, r:Math.random()}, type:'get', success:function(json){ callbackfunc(json); }, dataType:'json' }); } function callbackfunc(data) { console.log(data); alert("SUCCESS"); }
var url = '/user/info.php'; var params = { uid:1, r:Math.random() }; $j.get(url,params,callbackfunc,'json');
$j.get('/user/info.php', {uid:1, r:Math.random}, callbackfunc, 'json');
$j("#img").attr("src", url);
$("img").src = url;