SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast sportstoto3368's Avatar
    Join Date
    Apr 2004
    Location
    World
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Jquery Ajax call not working- help~

    Help, I would need some idea to write in jquery style.
    If there's any similar tutorial, it would be great.

    -------------------
    by using the normal js
    onclick will call to js, submit page to perform task, then back to the same page.

    <tr>
    <td><a onclick='doChange(7)'><img src='active.gif'></a></td>
    <td><a onclick='doChange(8)'><img src='active.gif'></a></td>
    <td><a onclick='doTask(9)'><img src='active.gif'></a></td>
    </tr>

    function doChange(id)
    {
    form.submit ... bla bla bla
    }
    -----------------

    Now with jquery and ajax onclick update to db and refresh this portion only.
    By using jquery, I don't need to use onclick='doChange(8)' anymore.
    I can use $("#7").click( function()....
    event will tied to jquery.

    How do I transform whole thing over? Create a unique id for every <a ?
    Create a class grouping for <a ?


    <tr>
    <td><a><img id="" src='active.gif'></a></td>
    <td><a><img id="" src='active.gif'></a></td>
    <td><a><img id= "" src='active.gif'></a></td>
    </tr>
    ?

    How do I pass the dochange(7) id into jquery ajax data: ?

    Blank of idea, how do totally convert it into jquery style?


    $(document).ready(function() {

    $("#a").click( function() {

    alert('haha');

    $.ajax({

    url: "ajax_updater.asp",

    type: "POST",

    timeout: 5000,

    beforeSend: function(){ },

    error: function(XMLHttpRequest, textStatus, errorThrown) {
    alert(XMLHttpRequest);
    alert(textStatus);
    alert(errorThrown);
    },

    success: function(output) {
    var status= output
    if(status==1){ alert('success') }
    else{ alert('fail') }
    },

    complete: function(){ },

    data: 'pk='+pk

    });

    alert('haha2');

    });

    })

  2. #2
    SitePoint Enthusiast sportstoto3368's Avatar
    Join Date
    Apr 2004
    Location
    World
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone got any idea on how to make this case happen?


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
  •