我正在尝试使用jQuery $.ajax()但我遇到了一些困难.
这是我要用于POST的文本框字段:
这是代码:
$.ajax({
type: "post",
url: "file.php",
data: $(this).serialize(),
success: function(data) { ...............
现在这是file.php:
if( $_REQUEST['url'] )
{
$url = $_REQUEST['url'];
$url = file_get_contents($url);
// I would need now to return something here but not sure how??!!
}
?>
现在,我的问题是,如何在这个PHP代码中返回变量并在上面的代码中使用它们,我的意思是在$.ajax()的成功部分.另外,如果我想在$url变量上执行一些额外的操作,该怎么做?如何归还? :/