aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Help with JSON Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic
Author

Help with JSON

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Hi all,

I'm busy building a minesweeper game in PHP and javascript.
Only problem is that I need to pass php the value of a javascript variable.
So...I downloaded the json.js file.But unfortunately,I dont know how to use it.
Assuming that I have:



Please help,I don't wanna go back to the scripted version of minesweeper!!


===>SCJP 1.5(72%)<===
==>SCWCD1.5(76%)<===
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
That prompt happens after you serverside code has run so you are not able to use that there.

The serverside code runs on the server. The clientside code runs on the client after the serveride code is fully done running and it is sent to the client.

Only way you can get your serverside code to interact with clientside code like that is through Ajax calls.

Eric
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Okay so I've tried to implement AJAX for the 1st time...everything seems to be working fine,I can even verify that the correct parameters are being sent in each AJAX
request.Only problem is that my php code that accesses the parameters(sent with XMLhttpRequest.open(,'GET',localhost\queryString,true) isn't executing at all..No echoes no nothing.
Please help:




It's the phpCatch() method called by doAJAX() that's not executing..
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

To explain how it works:

A user clicks on a cell in the table...the cells id is passed to the doAJAX() method which sends it via get to the phpCatch() method.
phpCatch() is then supposed to run a switch on the parameters to continue the game logic.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Please do not double post here...http://www.coderanch.com/t/427259/HTML-JavaScript/AJAX-method

CLosing this one, discussion can continue there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with JSON