Basically what I want to do is as a proof of concept is receive some
data from a server and display it on a page.
Server side file simply returns "Ajax Data" when called with POST
code.py
-----------------------------
class tabs:
def POST(self,*args):
return "Ajax Data"
--------------------------------------------------------
Client Side - The code below should receive "Ajax Data" text from
server after clicking #button and display it in sandbox area which is
a div
--------------------------------------------------------
jQuery("#button").click(function() {
$.ajax({
type: 'POST',
data: 'dummy'
success: function(data) {
alert(data); /*Debugging Statement*/
jQuery('#sandbox').html(data);
},
});
return false;
});
However nothing happens. When I added an alert to see what is being
returned. The alert Box displays
[object XMLDocument] while I was expecting a string.
> Client Side - The code below should receive "Ajax Data" text from
> server after clicking #button and display it in sandbox area which is
> a div
> --------------------------------------------------------
> jQuery("#button").click(function() {
> $.ajax({
> type: 'POST',
> data: 'dummy'
> success: function(data) {
> alert(data); /*Debugging Statement*/
> jQuery('#sandbox').html(data);
> },
> });
> return false;
> });
> However nothing happens. When I added an alert to see what is being
> returned. The alert Box displays
> [object XMLDocument] while I was expecting a string.
> Client Side - The code below should receive "Ajax Data" text from > server after clicking #button and display it in sandbox area which is > a div > -------------------------------------------------------- > jQuery("#button").click(function() { > $.ajax({ > type: 'POST', > data: 'dummy' > success: function(data) { > alert(data); /*Debugging Statement*/ > jQuery('#sandbox').html(data); > }, > }); > return false; > });
> However nothing happens. When I added an alert to see what is being > returned. The alert Box displays > [object XMLDocument] while I was expecting a string.
> What did I do wrong ?
> -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to webpy@googlegroups.com. > To unsubscribe from this group, send email to > webpy+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en.
On Thu, Sep 29, 2011 at 11:43 AM, Bruce Eckel <brucetec...@gmail.com> wrote: > I'll be publishing a web post on this very subject in the next couple of > days. I'll put a link to it on this group when I do.
>> Client Side - The code below should receive "Ajax Data" text from >> server after clicking #button and display it in sandbox area which is >> a div >> -------------------------------------------------------- >> jQuery("#button").click(function() { >> $.ajax({ >> type: 'POST', >> data: 'dummy' >> success: function(data) { >> alert(data); /*Debugging Statement*/ >> jQuery('#sandbox').html(data); >> }, >> }); >> return false; >> });
>> However nothing happens. When I added an alert to see what is being >> returned. The alert Box displays >> [object XMLDocument] while I was expecting a string.
>> What did I do wrong ?
>> -- >> You received this message because you are subscribed to the Google Groups >> "web.py" group. >> To post to this group, send email to webpy@googlegroups.com. >> To unsubscribe from this group, send email to >> webpy+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/webpy?hl=en.
Very nice article. I always wondered how to make a user application with web interface, and it's just webbrowser module! There's one misprint where you refer to num as sum: "... while sum is generated with JavaScript's random number generator ...".
PS.
I've just read you're Bruce Eckel who wrote "Thinking in C++". It was very nice, I started with it! I must say it's the only book I've read most completely about C++ :) I also remember reading "Thinking in Java" when I had a course about Java if I'm not mistaken.
On Fri, Sep 30, 2011 at 9:03 PM, michael kapelko <korn...@gmail.com> wrote: > Very nice article. > I always wondered how to make a user application with web interface, > and it's just webbrowser module! > There's one misprint where you refer to num as sum: "... while sum is > generated with JavaScript's random number generator ...".
> PS.
> I've just read you're Bruce Eckel who wrote "Thinking in C++". It was > very nice, I started with it! I must say it's the only book I've read > most completely about C++ :) > I also remember reading "Thinking in Java" when I had a course about > Java if I'm not mistaken.
> -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to webpy@googlegroups.com. > To unsubscribe from this group, send email to > webpy+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en.
>>> Client Side - The code below should receive "Ajax Data" text from
>>> server after clicking #button and display it in sandbox area which is
>>> a div
>>> --------------------------------------------------------
>>> jQuery("#button").click(function() {
>>> $.ajax({
>>> type: 'POST',
>>> data: 'dummy'
>>> success: function(data) {
>>> alert(data); /*Debugging Statement*/
>>> jQuery('#sandbox').html(data);
>>> },
>>> });
>>> return false;
>>> });
>>> However nothing happens. When I added an alert to see what is being
>>> returned. The alert Box displays
>>> [object XMLDocument] while I was expecting a string.
>>> What did I do wrong ?
>>> --
>>> You received this message because you are subscribed to the Google >>> Groups "web.py" group.
>>> To post to this group, send email to we...@googlegroups.com<javascript:>
>>> .
>>> To unsubscribe from this group, send email to >>> webpy+un...@googlegroups.com <javascript:>.
>>> For more options, visit this group at >>> http://groups.google.com/group/webpy?hl=en.