I'm trying to use jQuery $.ajax() but I'm facing some difficulties.
Here's the textbox field that I want to use for POST:
<input name="url" class="url" type="text" >
Here's the code:
$.ajax({
type: "post",
url: "file.php",
data: $(this).serialize(),
success: function(data) { ...............
Now this is the file.php:
<?php
if( $_REQUEST['url'] )
{
$url = $_REQUEST['url'];
$url = file_get_contents($url);
// I would need now to return something here but not sure how??!!
}
?>
Now, my question is, how to return variables in this PHP code and use them in my code above, I mean in the success part of $.ajax(). Also if I want to perform some additional stuff on the $url variable, how to do it? How to return them? :/