Some Good AJAX Tutorials?
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Some Good AJAX Tutorials?
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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Some Good AJAX Tutorials?
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.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.
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
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Some Good AJAX Tutorials?
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;)
Do not get me wrong I see the usage of JSON...just not for me;)
Re: Some Good AJAX Tutorials?
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.
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.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Some Good AJAX Tutorials?
1 - 2 depending on methodhallsofvallhalla 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?
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Some Good AJAX Tutorials?
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.
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.
Re: Some Good AJAX Tutorials?
You could technically do it all in one line. Just don't press enter
Very little important whitespace in javascript or php. Isn't jquery all on one line?
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Some Good AJAX Tutorials?
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 
Re: Some Good AJAX Tutorials?
If I remember right, it would also be faster :p
Re: Some Good AJAX Tutorials?
Wow the key to AJAX seams rather easy
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
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."
"The best thing about UDP jokes is that I don’t care if you get them or not."