SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem using jquery ajax

    I'm trying to get jQuery to load a div from a page into a div with id of display. I'm able to do this using a link in a menu but not using a checkbox.

    this is the code:
    $(':submit').click(function(e) {
    if($('#coconuts').is(':checked')){
    //alert("coconuts is checked");
    $.get('theQuest.html', function(data) {
    $('#display').html($('#coconuts', data));

    });
    }
    });

    If I check coconuts then click the submit button the alert notifies me so I am getting that far. This is my project so far.
    Final Project

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2007
    Location
    North Yorkshire, UK
    Posts
    483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't forget to cancel the click event, e.preventDefault(), otherwise the submit of the form will happen. Also have you seen the jquery .load method.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •