Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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>
share|improve this question
2  
see w3schools ajax php – Tamil Selvan Apr 20 at 5:52
refer this link to ajax call from javascript to php – Ranjith Apr 20 at 5:58

1 Answer

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?

share|improve this answer
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 – Niranjana668 Apr 20 at 6:09
what do u mean "it's on the same page?" – jeev Apr 20 at 6:14
javascript and php code in same page :) – Niranjana668 Apr 20 at 6:26
i hope that's what u r looking for? – jeev Apr 20 at 6:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.