Jump to content

Sending data using Jquery(Ajax)


Shilyaev
 Share

Recommended Posts


I've wrote code for sending array to another php file with mysql, everything works, but but i can't add CHANGE function to my code, to make code react on changes (checked/uchecked checkbox)

 

<div id="checkboxes">

    <input id="chkbx_0" type="checkbox" name="first" checked="checked" />Option 1

    <input id="chkbx_1" type="checkbox" name=second" />Option 2

    <input id="chkbx_2" type="checkbox" name="third" />Option 3

    <input id="chkbx_3" type="checkbox" name="fourth" checked="checked" />Option 4

</div>


 

 

<script>

$(document).ready(function () {

 

//

var name = [];

$('#checkboxes input:checked').each(function() {

    name.push($(this).attr('name'));

}).get();

 

//

$.post('load.php', {name:name[1]}, function(data){

$('#name-data').html(data);

});

 

//

 

});

 

</script>

 

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.