Results 1 to 8 of 8

Thread: ajax+php+mysql question

  1. #1
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default ajax+php+mysql question

    I've been trying to do this for like 2 weeks someone please help me.
    http://flash.tymatik.com/goober/index.php
    I am trying that when someone presses the digg button it will add a number through ajax.
    I mean my vote.php (http://pastebin.ca/720589) already does it I just want to show $diggs_found for each of the articles again. without refreshing.
    I need a JS function to call vote.php?digg=id and when it does show the new value which $diggs_found does that atm.

  2. #2
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    It works for me...

  3. #3
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    yeah but i want it to work through ajax , without refreshing.
    I understand that i need to make vote.php echo something maybe exit('OK:1234'); and then Votes: <span id=article_1234> alertContents function
    or replacing the div problem is I dont know how to do it all , calling vote.php and such.
    var file = 'vote.php?digg=';
    xmlhttp.open('GET', file + id, true);
    works for me for calling the vote
    <td width="67" height="20"><? echo '<a href="javascript:vote('. $row['a_id']. ')">'; ?><img src="2.jpg" width="67" height="20" border="0" /></a></td>
    with document.getElementById or something.
    Last edited by flash; 09-30-2007 at 02:46 PM.

  4. #4
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    As a user, it doesn't refresh for me, it just doesn't refresh the page...
    Sorry man but to me there isn't any refresh so, either you just changed it or your just seeing stuff...

  5. #5
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    man it refreshesssses maybe too quick for a human eye to see or maybe your connection is urber fast but it does
    I see it here clearly.
    You are right though sometimes it does it so quick that I was suprised too myself , but it does refresh.

  6. #6
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    yeh it does refresh... try this..

    for your refresh button do not...
    make it link to your index page..
    in the <a href="index.php"> to <a href="javascript:location.reload(true);">Refresh Page</a>

    its better...

    and in ajax.. make sure all your linked files are correct like..
    add these in front of your urls so it locates it properly..
    ../folder/ajax/diggit.php
    something like that in your urlls.. its what i use..

    try that
    Hey new design new look, goto xudas for personal webdsign help.. (:

  7. #7
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    thank you for the refresh button that works great
    the part of my ajax I got from here
    http://www.somecoders.com/2006/05/make-an-ajax-poll/
    which is not designed for what im trying to do .
    I need to know what to change here inorder to make it work
    document.getElementById('option' + id).innerHTML = content;
    javascript:vote(3) for example when i click vote works but I want it to show the new diggs without refreshing.

  8. #8
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I've found this
    http://209.85.135.104/search?q=cache...lnk&cd=1&gl=il
    Question is what would the sendy.js would look like for this to work , I imagine it needs to have a var that would call the diggit.php file.
    please help.

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
  •