Hi Karl and company,
$.get is a wrapper around an HTTP get. So the page code loads a version
of jquery, which includes a get method someplace within it. When the page
code calls this, it will want to work with XMLHttpRequest supplied by the
DOM. So it goes to our XMLHttpRequest code in startwindow, or should.
From there, it calls our native method for inline HTTP requests, in
jseng-moz.cpp. It can
then fire the request, get some html, send it back to startwindow, and
from startwindow send it back to the page's code. When it says
function (data) { ...
, this is a handler that specifies what it will do with the HTML
that is returned. It could do particular DOM splices, put the response
into a div, or stuff like that. I am not sure if it is formally correct
to call it a callback, but that's the idea.
So the pieces are there, but it has not been exercised
that much. When I was trying to get the drescher site working, it was a
cycle like this and in some cases it worked. So the good news is that
the intentions of this snippet represent a common thing to want to do, so
effort we put into it will pay off.
Here's a paraphrase of the entire snippet. Yes, as Chris says, the $ is
just an alias for the jQuery object. It tests for the presence of a
certain table which is subsidiary to the node scheduled_top15s. If not
found... if (not ( blah blah expression has length) ...
you go grab it inline, using GET,
and once you have it, you follow the instructions in the handler, so in
this case it populates the innerhtml of scheduled_top15s with the
dynamically retrieved tags. And our native C++ will handle
this, which is very cool!
At this point, whatever code follows can rely on that thing existing
because you either verified its presence or grabbed it using GET.
if(!$("#scheduled_top15s").find("table").length){
$.get("php/get_scheduled_top15s_public_2.php", function( data ) {
$("#scheduled_top15s").html( data );
});
}
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev