155
rated 0 times
[
162]
[
7]
/ answers: 1 / hits: 57882
/ 13 Years ago, fri, november 25, 2011, 12:00:00
I'm having trouble bringing back data from my PHP file. I guess I don't really understand the data parameter of this jquery function so I just went off some tutorials.
Jquery
$.ajax(
{
url: 'test.php',
dataType: 'text',
data: {test: '1'},
success: function(data)
{
window.alert(data);
}
})
Now from my understanding the test:
declares the variable used in php and 1
is the value in that variable. But I'm not entirely sure...
Here's my PHP
$item1 = $_POST['test'];
echo $item1;
Now it's just supposed to alert that value so I know it is at least returning something but in the alert it's just blank so I'm losing the value somewhere, but where?
More From » php