jQuery Ajaxify – Update

I’ve been doing more work on the jQuery AJAXify plugin, it’s now a lot more robust (I think…) and I’ve squashed a few bugs that were in the previous version (with help from Andrea Battaglia) along with adding in a few new features (with their own bugs no doubt!).

Theres an updated test page and as ever a direct link to download here.

Check out the test page to see the new features!

Edit: Further updates, all links have been updated to version 0.3b. Added (and documented existing) callbacks as requested by Sebioff! And a further fix for the ‘append’ option. Also fixed IE6 compatibility.

Further Update: Another update after the comment from David Lee about $(‘form’).serialize();

Another Further Update: I have set up a Google Code repository for this plugin, which states that this code is released under the MIT license.

Update October 2010: I have updated this plugin for jQuery 1.4.3 as a ‘lite’ version.

19 Replies to “jQuery Ajaxify – Update”

  1. Thanks for this plugin, works great for me! Really nice that it submits everything quite like the browser would (even image buttons!).
    There’s another jQuery plugin called Ajaxify, though that one doesn’t seem to work with jQuery 1.3.
    As improvement suggestions: I’m missing some callbacks, e.g. for when the request failed (I guess this could be used instead of the message/waiting-options) and some way to modify the data returned by the request (another callback?).
    Also, some way to append data to the POST-values would be cool as well.

    1. Hi Sebioff,

      Thanks for the feedback, I’ve updated the page with the features you requested.

      You can append data to the request using the ‘data’ options key. A string will be appended as-is, any other types will be passed to jQuery.param().
      All the existing callbacks for the jQuery AJAX object should work fine now.
      A callback for the waiting trigger has been added too.

      Hope it helps!



      1. Awesome, thanks!
        I’ve got another question: since you support the enctype-attribute I guess it should be possible to ajaxify forms with enctype=”multipart/form-data”, though that doesn’t work for me (no $_POST set on the server, doesn’t seem to submit anything). Is it possible to ajaxify forms with file-uploads?
        Also, I can’t override ‘append’ (both in 0.2 and 0.3), it always adds ajax=1.

        1. Hi Sebioff,

          The enctype attribute is indeed used, but AJAX requests cannot handle file uploads at all, which is quite frustrating…
          There are quite a few pages with information, plugins and other resources to be used instead; this thread on stackoverflow has a good rundown: http://stackoverflow.com/questions/166221/how-to-upload-file-jquery.

          There was a bug in the code regrading the append option, when I changed the storage of the options from central to local, I missed this bit of code. I’ve made this minor change and updated the links. Thanks for finding it 😉

          Hope this helps!


  2. Hi there, thanks for the plugin! There’s a bug, however, where it calls escape instead of encodeURI to escape values. You can just do a search & replace to change all 6 instances of escape into encodeURI.

    Actually, just using encodeURI will break since it won’t escape ‘=’ and ‘&’. The correct thing to do would be to get rid of serializeForm() and just use jQuery’s serialize().

    1. Hi David,

      Thanks for your comment! After checking out the serialize() function, I agree. I can’t think of a reason that I didn’t use it originally! It would have avoided all the previous bugs! Typical…
      I’ll get a new version up-together and let you know when I do.



  3. Nice plugin…However, I’m not quite sure if I’m using it correctly.

    I have a container $(#container). I want every link inside to be ajaxed into it even when the content is replaced. Initially it has just one link to do the initial load.

    $(‘#container a’, this).ajaxify();
    //load the widget
    $(‘a.widget-trigger’, this).trigger(‘click’);

    This works, however, links inside don’t get ajaxified.

    So I tried a delegation approach:

    $(‘#container’, this).ajaxify();

    That doesn’t work at all.

    Any idea what I need to do to make it work?

  4. You might want to skip the update if the dataType is not html or text.

    Here is a quick work around for this issue:

    if (options.dataType == "html" || options.dataType == "text") {
      if (options.replace) {
      } else {
  5. Good to see you’re using serialize().

    Is there an official project page for this project? What license is the code distributed under?

    1. Hi David,

      Thanks for checking back!

      Yeah, I updated to serialize() after your comment, plus various other changes too…

      There is no project page as such, just this post (and any subsequent update posts!) and the project page on the jQuery site, maybe someday I’ll knock one up? I was thinking of making two versions of the script, a ‘lite’ version and the full version, or maybe a pick and choose which features option, but as ever life gets in the way of the fun stuff!

      The code is free to use on any project, internal or external. I figure most people who’d want to use this would pay little heed to the various licenses… I’d really like to see any projects that this is used it though as it’s cool to know you’re helping out!

      1. You know, there’s another project named jQuery Ajaxify that’s very similar to this project. It caused a bit of confusion at my company 🙂

        All the more reason to have a project page. Having a github repo also an easy way to have a project page up. Check it out.

        The reason I asked about the license is because our company’s legal department might force us to remove Ajaxify because it is not distributed under a license. It would be nice if you can include an MIT or similar license as a commented blurb at the top of your script so that our company can use it.

        1. Hi David,

          I am aware of the other ajaxify plugin (maxblog.me/ajaxify) but as far as I know it doesn’t work well with the newer jQuery versions… Apologies for any confusion, I’d picked the name before even searching for the other, didn’t really expect anyone else would want to use it! 😛

          I can give express permission in writing if required, or I can bundle a version of the script with the MIT or similar license, either way, please let me know.

          I would also like to set up a project page of sorts, I guess the closest to a project page is this post, when time allows I might have a bit of an overhaul… 🙂

          Thanks again,


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.