I wanna pass a JavaScript variable in to php using Ajax... coz I wanna pass it onclick. I'm getting the onclick value to variable row. Help would b gratefull :) Thank You
<script type="text/javascript">
function updateTable(row) {
alert (row);
var row = (row);
}
</script>
asked Apr 20, 2013 at 5:50
-
2see w3schools ajax phpTamil Selvan C– Tamil Selvan C2013年04月20日 05:52:44 +00:00Commented Apr 20, 2013 at 5:52
-
refer this link to ajax call from javascript to phpRanjith– Ranjith2013年04月20日 05:58:04 +00:00Commented Apr 20, 2013 at 5:58
1 Answer 1
Did u try this?
$.ajax({
url: 'do.php',
type: 'POST',
data: "userID=" + onlyID,
success: onMemberSucces,
error:onMemberError
});
function onMemberSucces(data) {
alert(data);
}
function onMemberError() {
alert("Error!!");
}
where do.php is your php file and onlyID is your javascript variable.
Is this what you were looking for?
4 Comments
Niranjana668
thanx for the reply.. First of all it's on the same page.sorry I culdn't mention that. Yeah i tried this one and some other but nothing happen... Thank you
jeev
what do u mean "it's on the same page?"
jeev
jeev
i hope that's what u r looking for?
default