-2

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
2

1 Answer 1

0

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?

answered Apr 20, 2013 at 6:00

4 Comments

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
what do u mean "it's on the same page?"
i hope that's what u r looking for?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.