-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>
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?

Sign up to request clarification or add additional context in comments.

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?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.