Hey Luka,
one way to do this would be to check in your somefile.php if it's an
ajax or regular call, and if it's an ajax call just return the variable, eg:
<?php
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
//ajax request
print $var;
exit();
} else {
//normal output
}
?>
hope this makes some sense,
dennis.
luigi7up wrote:
Hello everyone,
Is it possible to send ajax call for somefile.php and get just value
of one php variable generated by that server
script?
Example:
$.post( blog.php?task=checkname,
{ime:$(\"#ime\").val()},
function(msg){
alert(msg);
});
This ajax call will get whole page ( blog.php?task=checkname) as a
result but I want value of just one variable.
I know I could create a separate file "ajaxCheck.php" that would
return HTML I could reuse in my javaScript
but I want to solve this this way.
Im probbably using wrong method POST & GET. Should I be using jSON?!
How do I use it for this purposes
Thank you
Luka