Opensource Development and Life
RSS icon Email icon Home icon
  • Dreamhost List AJAX

    Posted on June 21st, 2007 Quad341 12 comments

    I noticed that there was some interest on the Dreamhost forums for AJAX to register for lists. I thought this was a good idea, and upon finding no solution, I set out to make one.

    I admit that both this is not terribly easy to set up nor is it terribly hard. You have to modify 1 php file and include the required components on your web page. There is a full readme enclosed to help you get it set up.

    If you have any questions or comments, please leave a comment!

    Download the code

     

    12 responses to “Dreamhost List AJAX” RSS icon

    • Robert Parker

      Nice! Thanks for taking the time to do this, and for sharing it with us. Rock ON!

    • Thank you SO MUCH for this! You ROCK!!!

    • I’m trying to get this working with the e107 CMS system, and the one question I’m not clear on is what URL to send the results to when setting up the DH Announcement list. Is it the page I have the app on, the handler PHP file, or something else?

    • David

      I’m not sure exactly what you are asking (I’ve never used the e107 CMS system). Your form for adding a user should post to the announce list handler php file (from the zip) which will then forward the information to dreamhost for you. This means that AJAX enabled requests will be sent to the handler as well as standard POST requests. If you were looking for something else, could you please clarify?

    • Hi, I’m actually asking about the configuration of the DH announcement list. I’ve got it set up to send the results to the list handler php file, as that is what I assumed needed. My basic problem is that it doesn’t seem to post the updates back to my code. I’m new to AJAX completely, so I may be missing something.

      I’ve also taken a step back and am just using the example.html file to verify that it’s not the CMS that is causing the problems, and I’m getting the same result.

    • Just for testing, I threw together a new example list. I only specified the title, from address, and domain. Then in announceListHandler.php, I changed the list and domain variables to reflect what they are (example and dev.quad341.com respectively if you’d like to see if you can post against that list)

      If that doesn’t help, I might be misunderstanding what you are expecting versus what you are seeing.

    • Thanks, I think I have it working now with the example.html file. I think my problem was with a couple of minor changes I made to the announceListHandler.php when I was having problems. I’ll try again with the code in the CMS and see what happens…

      Oh, and in answer to my first question, the URL’s in the DH list setup appear to have to point to the example.html file, not the handler file. That was the piece that finally got me working, and the piece that was wrong from the start.

    • quad341…

      thanks for the code…

      -c

    • Thanks for putting this together. Worked out of the box for me.

    • Thank you for sharing this! It is exactly what I needed, except for one little issue…

      I am trying to use this in a wordpress theme. I have had to do a few extra steps: putting the js files in the right place and correctly linking to them; changing links like these:

      into links like these:

      <script type="text/javascript" src="/js/sarissa.js”>

      i’m now at the point where the page refreshes when I submit the form, but I don’t know what’s going on and I’m not getting any feedback. I haven’t gotten any confirmation emails via the DH cgi script, so I know it hasn’t made it that far.

      I changed “$debug = true;” in the announceListHandler.php file, but I’m still not getting feedback.

      Since you know your code better than I, and are clearly more skilled with ajax, is there anything else that you think I should do?

      Thanks!

      Liz

    • Hi Liz

      What it sounds like to me is that your form that you have on the page isn’t getting wired into the ajax actions correctly. If you look in example.html, you will notice that, after including two javascript files, it has a third javascript section. That section actually attaches an “on submit” action to the form so that it knows to dispatch an ajax request. This should actually stop the page from refreshing. Even without it, it should work, but the action of your form may not be set correctly. The action of the form should point at the announceListHandler.php file itself (in case someone has javascript disabled).

      The debug flag will actually cause the ajax to not work correctly for feedback, but will give you the exact request it sent and got back. This is very useful to see if a bad request was generated locally or if the remote server has more information to help. With debug=true on, you should just submit the form (or an example form) to the php file directly and see if it returns with a success return code. If you are using an ajax call for that, i would suggest using something like firebug (firefox extension) to watch the exact return text of the ajax call (under the net tab i think).

      If that doesn’t work, hopefully you can at least get the debug output and we can start debugging that.

      hope that helps

      jim

      PS. The images for the header of your current site are quite nice

    • Hi. I’ve been testing this code and can’t get it to submit to an Announce List, even leaving the values as they are in announceListHandler.php it won’t submit to your list?

      On submit, the wee loader graphic displays for a little while but I don’t get any response? Nothing showing in Firebug either for the GET response.


    Leave a reply