Some Good AJAX Tutorials?

For discussions about game development that does not fit in any of the other topics.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Some Good AJAX Tutorials?

Post by hallsofvallhalla »

you now hold the key to ajax. With that echo statement you can do soooo much. Nearly everything. Don't be talked in to using json to parse it either. Use simple javascript split() to separate the ajaxRequest.responseText into an array that you can define your page with, It is far more powerful than given credit for.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Some Good AJAX Tutorials?

Post by Jackolantern »

hallsofvallhalla wrote:you now hold the key to ajax. With that echo statement you can do soooo much. Nearly everything. Don't be talked in to using json to parse it either. Use simple javascript split() to separate the ajaxRequest.responseText into an array that you can define your page with, It is far more powerful than given credit for.
JSON is faster than using string parsing techniques, and is relatively easy. JSON is the way to send a ready-to-use array through AJAX that needs no parsing at all (it is all native Javascript). I spent some time dealing with it yesterday, but I found out after a while that my issues were due to my PHP after all (a pretty stupid mistake at that). It is actually very easy.

To the OP:

You know everything you need to using AJAX. Just learn to do more with Javascript so you can use that data from the web server in more constructive ways. You are right in your assessments of each technology, although it could be noted that Javascript is what uses the AJAX data passed from the web server. Without the rest of Javascript, AJAX is nearly useless.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Some Good AJAX Tutorials?

Post by hallsofvallhalla »

I found JSON to be nothing less than annoying and if you are sending information large enough to see the difference in parsing then the request will be so slow it wont matter. I guess it is preference. I can echo and parse a whole map's worth of data in 3 lines(not including the query which is standard). How many does it take with JSON?

Do not get me wrong I see the usage of JSON...just not for me;)
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Some Good AJAX Tutorials?

Post by Noctrine »

The difference is there is less of a chance that individual things will be broken in a way that can be really damaged. It still happens but since its a community behind it they atleast make sure that the releases are relatively bug free. Not to mention that there is already alot built off of it, I actually abandoned my old Ajax stuff on Indiepoint to just redo it with Jquery.

Anyway with the other stuff:

My point was. If you don't like Javascript, why are you looking to use Ajax.

You also didn't really specify what vunerability you are worried about. Are you worried about people copying your scripts? Than Obstrufication is really the only way (atleast that I know of, my lead programmer has made some BA ones though), it will stop the generic people but it won't be much of a deterrent to people really want it. (For example, Stack Overflow and its Open Source Alternatives, Second Life and its Open Source Alternatives, Google's Pacman and the Open source alternative that someone just wrote)

But since you weren't clear I went with the usual worry that people have, data handling security, hence why I said it was shoddy programming. Not that YOU yourself make those issues but alot of people do especially people who try their hand at html based browser games. If I had a dollar for all the missing injection and XSS stuff I've seen in people asking me for help....

But now that you mention it, I would have to assume that you are new, but not in any way to put you down. Usually (unless you one of a small few of people on this site who I really pay attention to) I don't really look at a persons username, nor really care about a persons project in general (Unless in some way it conflicts on one-to-many levels with mine, but I still help out -Like hall's new web RPG engine :p-). I just look at the question and answer. But if you are going to individually take offense to what I say when generalizing (because of how something is phrased or give an accurate example of your level of expertise. I'll just excuse myself from trying to help you anymore.

Edit: Cleaned it up, it wasn't Bad, but it also wasn't very polite.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Some Good AJAX Tutorials?

Post by Jackolantern »

hallsofvallhalla wrote: I can echo and parse a whole map's worth of data in 3 lines(not including the query which is standard). How many does it take with JSON?
1 - 2 depending on method ;)
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Some Good AJAX Tutorials?

Post by hallsofvallhalla »

i am including the php echo and the return output. :)

eh either way it is preference in my book. I see no speed gain in what I am using it for. Like I said not saying JSON is bad or not useful.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Some Good AJAX Tutorials?

Post by Noctrine »

You could technically do it all in one line. Just don't press enter :P Very little important whitespace in javascript or php. Isn't jquery all on one line?
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Some Good AJAX Tutorials?

Post by hallsofvallhalla »

haha well that's cheating, i guess it depends on your screen size. I have 4 24" widescreens at work so I can get the whole page on one line :P
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Some Good AJAX Tutorials?

Post by Noctrine »

If I remember right, it would also be faster :p
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
Qunox
Posts: 64
Joined: Thu May 06, 2010 4:33 pm

Re: Some Good AJAX Tutorials?

Post by Qunox »

Wow the key to AJAX seams rather easy :D but that is a good thing, right?
Well I'm not experienced with JavaScript so i do not know how to use split() too handle diffrent stuff in the string.

Well can't the user save the page localy, edit the JavaScript and run it from the desktop?(With modyfied pages)? I'm asking since i really don't know.
As far as the source code i guess a obfus is the solution...just need too get it to work xD
Here take a bad computer/programming-thingy joke:
"The best thing about UDP jokes is that I don’t care if you get them or not."
Post Reply

Return to “General Development”