您只需打印/回显您的“返回”值即可。
file.php
<?phpif( $_REQUEST['url'] ){ $url = $_REQUEST['url']; $url = file_get_contents($url); // I would need now to return something here but not sure how??!! echo "something";}?>然后在您的JS中:
$.ajax({ type: "post", url: "file.php", data: $(this).serialize(), success: function(data) { console.log(data); // "something" }});作为旁注。您的脚本看起来像接受任何URL并获取它。可能会滥用这样的脚本。确保您知道这一点。



