|
Post by turbov21 on Oct 28, 2007 20:20:24 GMT -5
Here's a little AJAX (minus the XML) demo I threw together so if anyone ever asks if RB handles AJAX, we can tell people an unequivicable "maybe". Let me post the code, and post the bug down at the bottom. The demo is here.demoAjaxbtn$ = "Hello"
[start] cls html "<script type=""text/javascript"" src=""/js/ajax.js""></script>" html "<script type=""text/javascript"" src=""/js/grabbr.js""></script>" html "<input type=""button"" value=""" + btn$ + _ """ onclick=""httpRequest('/seaside/go/runbasicpersonal?app=RawTest&btn=" + btn$ + "', Grabbr)""/>" print "" link #hihi, "Hello", [hi] print "" link #byebye, "Goodbye", [bye] wait
[hi] btn$ = "Hello" goto [start]
[bye] btn$ = "Goodbye" goto [start] |
RawTestraw GetVal$(UrlKeys$, "btn") end
' Grabs a value from the url function GetVal$(string$, key$) value$ = "" key$ = key$ + "=" startit = instr(string$, key$)
if startit > 0 then startit = startit + len(key$)
endit = instr(string$, "&", startit)
if endit > 0 then endit = endit - startit value$ = mid$(string$, startit, endit) else value$ = mid$(string$, startit, len(string$)) end if end if GetVal$ = value$ end function |
Javascript files are here: http://kerovia:8008/js/ajax.js http://kerovia:8008/js/grabbr.js Anyway, here's the problem, and I'm not sure what's going wrong... The code above works perfectly in Firefox, but whenever I use the "Hello" or Goobye" links in IE7 or Opera it refreshes to the login screen. This happens whether I press the button or click the links first. So...AJAX works in Run BASIC, but my program does have a bug in it.
|
|
|
Post by billw on Oct 28, 2007 21:16:48 GMT -5
Isn't Run BASIC supposed to be an abstraction of AJAX?
|
|
|
Post by carlgundel on Oct 28, 2007 21:56:20 GMT -5
Isn't Run BASIC supposed to be an abstraction of AJAX? Run BASIC doesn't attempt to be an Ajax platform in its current incarnation. There is a little javascript in there but it can hardly be considered Ajax. I do plan to add some Ajax features later on but I have a lot to learn about that stuff. -Carl
|
|
|
Post by carlgundel on Oct 28, 2007 21:59:17 GMT -5
Anyway, here's the problem, and I'm not sure what's going wrong... The code above works perfectly in Firefox, but whenever I use the "Hello" or Goobye" links in IE7 or Opera it refreshes to the login screen. This happens whether I press the button or click the links first. So...AJAX works in Run BASIC, but my program does have a bug in it. So in principle you are able to make it work on Firefox, but IE and Opera are doing something different with your Ajax code. This sort of browser incompatibility is pretty common and one of the challenges of creating portable browser apps. -Carl
|
|
|
Post by turbov21 on Oct 28, 2007 22:07:48 GMT -5
So in principle you are able to make it work on Firefox, but IE and Opera are doing something different with your Ajax code. This sort of browser incompatibility is pretty common and one of the challenges of creating portable browser apps. -Carl I think it must have something to do with the way IE and Opera loads the JavaScript within the body of the HTML.Haha! Fixed it. It was the form tag that was messing it up. Going to fix the code now.
|
|
|
Post by billw on Oct 28, 2007 22:29:59 GMT -5
Carl: I guess what's needed is a seperation of Ajax as a buzzword, and AJAX as a platform. The only thing that separates RB from being regular ol' AJAX (the technology) is the fact that there is not any client-server XML transfer involved in the core application. Because of RB's nature as an appserver, that doesn't really need to be exposed, if it's needed at all. So it's Ajax (as a buzzword) without the AJAX (as a technology). Or something like that. The point is, RB is what it is. Fighting it for buzzword compliance (using XML to transfer stuff when the built-in capabilities work just fine) is just plain dumb. Add more shiny stuff - use XML if necessary - but please don't get caught up in all the hype. Just call it Web 2.0, and all will be well.
|
|