我正在使用jQuery和JavaScript,我需要在JavaScript代码中调用jQuery函数。用JavaScript调用jQuery函数
我的jQuery代码:
function display(id){
$.ajax({
type:'POST',
url: 'ajax.php',
data:'id='+id ,
success: function(data){
$("#response").html(data);
}//success
}); //Ajax
//Here I need to return the ajax.php salary
//return ?
}
我的ajax.php文件有:
<?php
session_start();
....
echo "$salary";
?>
我的JavaScript函数有:
my.js
function showName(){
var id = 12;
var a = display(id); //Here I need to call the jQuery function display().
}
下如何调用内部的JavaScript jQuery函数代码以及如何将PHP值返回给jQuery?
该行 $(“#response”)。html(data); 是不是应该是 $(“#response”)。html(response); ??? – AceMark 2010-03-29 14:52:31