tags:

views:

35

answers:

2

hi i want to submit the page through following code but i can't get post data on ajax.php please tell me where i am wrong

new Ajax(wgScriptPath +'/' + 'ajax.php', {
              method: 'post',
              data:{items:item},
              onComplete: function(res)
{
              ////Code
}
+1  A: 

to keep it simple and fast you can use open source jquery.

$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success
  dataType: dataType
});

check links below - http://api.jquery.com/category/ajax/

example

<script>
    $(document).ready(function() {
        $('#checkbox').click(function() {
        $.ajax({type : "POST",
            url : "test.php",
            data : "ffs=somedata&ffs2=somedata2",
            success : function() {
                alert("something");
            } 
        });
        });
    });
</script>
<body>
        <input type = "checkbox" name = "checkbox" id = "checkbox">
</body>
JapanPro
A: 

Mention the framework you are using, assuming you are using prototype, try below code

new Ajax(wgScriptPath +'/' + 'ajax.php', {
              method: 'post',
              parameters:{items:item},
              onComplete: function(res)
{
              ////Code
}
});
Sandy
You also have a type in your code, a missing `)`
Dennis Haarbrink
i am usig mootooo.js for this
Rohit