[resolved] ajax problem (4 posts)

  1. lrebrown
    Posted 9 years ago #

    i'm having some AJAX problems with a wordpress plugin i'm developing. i just cannot get a responce.

    heres my code, heavily stripped down:

    [Moderated: That's just a bit too much code to dump into a forum. Please either paste a link to a hosted text file or use a pastebin such as http://wordpress.pastebin.ca with a link here. Thanks.]

    upon clicking 'delete' and selecting 'ok', it prints '<p>sending data...</p>' in the result box, then after a short pause, replaces it with '0'...

    please help, i'm completely stuck, i've been trying all day :(

    i'm using wordpress 2.2.1, php 5.2.3, and apache 2.2.4 (on windows) btw

    thanks for any help you can give me

  2. lrebrown
    Posted 9 years ago #

    ok, heres the code: http://wordpress.pastebin.ca/629228

    someone please help!

  3. lrebrown
    Posted 9 years ago #

    small update. i did some playing around. making the ajax variable global solves one issue: it now runs the onCompletion() function and displays a success result.

    the bigger problem is still present though - retrieving something from the server!

    i've enabled the execute option, and i'm now using the second line in aprmc_test() rather than the first, but nothing happens... no message box like there should be...

    if i print out this.response/self.responce with an alert() it just prints the number zero...

    why is it doing that? :(

    i'm completely new to ajax and wordpress plugin development so i'd really appreciate help on this

  4. lrebrown
    Posted 9 years ago #


    turned out that wordpress automatically prepends 'wp_ajax_' onto the supplied action in order to find the action hook. i didn't realise that and was specifying that myself resulting in wordpress looking for a non-existant action named 'wp_ajax_wp_ajax_aprmctest;.
    because it wasn;t finding the hook, it went onto the next line which was a die('0'); command, hence the mysterious resulting number zero!

Topic Closed

This topic has been closed to new replies.

About this Topic