edit3: i am using this script inside a facebook app, and not sure how to do it
i am passing a var to a php file using a post:
<div id="talentnum" class="cont_talentnum"><?php echo $number; ?></div>
<a class="mine_click" href="#"></a>
js here
var strtalentnum;
$('.mine_click').live('click', function() {
strtalentnum = $(this).closest("li").find(".cont_talentnum").text();
$('#mine').trigger('click');
});
$("#mine").click(function(){
if(strtalentnum){
$.ajax({
type: "POST",
url: "fb_test.php",
data: strtalentnum,
success: function() {
var talentnum = strtalentnum; //this is 6203222
alert(strtalentnum);
}
});
}
});
and the php file is :
<?php
function fb_test()
{ echo 'xxx';
echo $_GET['strtalentnum'];
}
?>
then i call the function in the same html page:
<?php function fb_test(); ?>
If i run this i get only the xxx. I also get the success alert in my case '6203222' so i know that the POST is happening
if i look in Chrome Network Headers i can see that :
Request Method:POST
Status Code:200 OK
Form Data
6203222:
Why i cant get it using $_GET['strtalentnum']; ?
any ideas?
thanks
edit: $_POST['strtalentnum']; wont do the job either
edit2 added html
You need a variable name for that:
Form:
Test it now: