【发布时间】:2010-10-03 09:28:02
【问题描述】:
我正在使用 jQuery 和 JavaScript,我需要在我的 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?
【问题讨论】:
标签: php javascript jquery ajax