Arc Forumnew | comments | leaders | submitlogin
1 point by CatDancer 5938 days ago | link | parent

If you want to make an AJAX call from your browser to fetch some HTML from your server and put that data inside a div, you don't need to use JSON for that. Just have your Arc op return the HTML.

Untested, so I apologize for any mistakes:

  (defop grabdata req
    (pr "This is my <i>HTML</i> content!"))
and, in the browser, using for example JQuery (http://jquery.com/) as a convenient way to make the AJAX call:

  $.get("http://yourserver.com/grabdata", function (data) {
    $('#your_div').html(data);
  });
replaces the contents of the div that has the id "your_div" with the HTML content returned by grabdata.


1 point by thaddeus 5938 days ago | link

I don't think I learned anything about JSON, but holy crow jquery is awesome.... The chaining methods alone just made my day! :)

-----