Page 1 of 1

<--- is stupid,javascript will not enter my brain

Posted: Mon Dec 20, 2010 8:46 pm
by zvi5
[center]any 1 have the keys?![/center]


I tried!, And again I tried!And even one more time!


but i just dont get it :(

and i know its super basic, and i want to get it working with php, and i want ajax, and all i have is a lot of will and the understaniding of "alert this and var that"


i get that part well =)

but how the snitzl am i suppose to get php incremented? ajax?! dont even start with me :(

tips?

thanx guys your a huge help...
have a great night =)

Re: <--- is stupid,javascript will not enter my brain

Posted: Mon Dec 20, 2010 9:36 pm
by alexander19
I had the same problem with it..did many tutorials and still couldnt learn a thing about js.
But then I saw jquery(a js library),which made js a lot easier to learn and it really helped me in the long run.
And for sending data from a php script to js you should use JSON which is more reliable and gives you a better control over the data you send.

Good Luck learning! ;)

Re: <--- is stupid,javascript will not enter my brain

Posted: Tue Dec 21, 2010 4:26 am
by Jackolantern
Yep, the "key" is definitely jQuery. You do need to know at least the basics of vanilla Javascript before you start doing serious work with jQuery, but you don't need to know how to do complex page effects before learning jQuery. jQuery is how Javascript should have been.

Re: <--- is stupid,javascript will not enter my brain

Posted: Tue Dec 21, 2010 4:26 pm
by hallsofvallhalla
i am not a great coder but I really have not had much issue with raw JS. The key for me was to use it in examples. Like use it as I built my game. It is not a super simple language so don't be hard on yourself.

They key to using it with PHP is building the variables

Code: Select all

var strength = <?php echo $playerinfo3['strength']; ?> ;
then using it to some value

Code: Select all

var randstrength = Math.floor(Math.random()*strength)

Re: <--- is stupid,javascript will not enter my brain

Posted: Tue Dec 21, 2010 6:44 pm
by Torniquet
i personally love jquery library. super simple to use and a fare few plugins to make things even simpler.

@halls.

burying php into js is ok, but you cant put it into external js scripts or into Obfuscated script.

i prefer to put any variables into hidden inputs then use the attr method to grab the value.

if you need any tips on using jquery ill be happy to help :)

Re: <--- is stupid,javascript will not enter my brain

Posted: Tue Dec 21, 2010 10:36 pm
by hallsofvallhalla
when pulling must have queries in the start of the load it one of the safest ways to get it. PHP is far safer than Ajax or jquery.

I am actually learning Jquery now. Not too bad...I am starting to like. :)

Re: <--- is stupid,javascript will not enter my brain

Posted: Wed Dec 22, 2010 12:11 am
by Jackolantern
hallsofvallhalla wrote: I am actually learning Jquery now. Not too bad...I am starting to like. :)
Come to the dark side. Once you get used to it, you would rather take a long walk down a short reactor shaft than write vanilla Javascript.

Re: <--- is stupid,javascript will not enter my brain

Posted: Wed Dec 22, 2010 8:51 pm
by hallsofvallhalla
hehehehe

Re: <--- is stupid,javascript will not enter my brain

Posted: Wed Dec 22, 2010 9:30 pm
by Chris
Jackolantern wrote:Come to the dark side.
I've joined the dark side. Funny how against jQuery I was and now how much I rely on it now..

Re: <--- is stupid,javascript will not enter my brain

Posted: Wed Dec 22, 2010 10:18 pm
by Jackolantern
Chris wrote:
Jackolantern wrote:Come to the dark side.
I've joined the dark side. Funny how against jQuery I was and now how much I rely on it now..
Holy crap! Chris is on with jQuery now! The rebels are doomed!