How to finish the php



  • Hello, everyone, I've got a problem with AJAX asking for ID treatment:

    <input type="checkbox" onclick="dels('.$reblogs['blog_id'].');">
    

    This ID needs to be recorded. And there's a lot of them.

    function dels(id) {
        $.ajax({
            type: 'POST',
            url: '/ajax/test5.php',
            data: {
                test: id
            },
            success: function(data) {
                var x = id;
                $('.results152d').html(data);
            }
        })
    }
    

    This is AJAX. I can't figure out how to sign the mass. Say the plug, he passes one parameter, but he's different. $_POST['test']



  • ajax request is how to open a page: one request is one page, one php script worked. If you need a php full of all chequeboxes, you'll have to put them all in one ajax request. Give every checkbox a name. name="..." and instead data: ... Somehow:

    data: $('input[type="checkbox"]').serialize(),
    

    Then all the chequeboxes on the server will be off like a "mia Paul=on." http://jsfiddle.net/sergiks/ctegL32o/

    Second moment, don't write in every input "onclick" - hang the processors the same jQuery:

    $('input[type="checkbox"]').on('click', function(e){ что делать });
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2