Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




78 posts

Master Geek


# 39391 13-Aug-2009 15:39
Send private message

Hi all,

I have this concept in my mind and I'd like some insights as to what is needed in order for this concept to work.

I envision a site that has some sort of interactive widget (for example, a calculator). Now let's say after the user hits the "Calculate" button, not only the widget would show the result immediately on the web browser, it would also update the result in the database on the backend.

Can a javascript do this? I understand that javascript is a client-only tool and as such has no capability to pass information to the server.

Or maybe instead of using a real database such as mySQL, I use a simple spreadsheet like Excel?

Can the script pass the information and update the spreadsheet as the user hits the button? I would imagine you can't do this since the spreadsheet still lies on the server.

So basically what I'd like to achieve is for this web application to update some file I have (either stored in the web server or my local hard drive) so I can keep track of the changes done by the user(s).

Any ideas?

Thanks heaps in advance :)

Create new topic
Professional yak shaver
1599 posts

Uber Geek
+1 received by user: 8

Trusted
BitSignal
Lifetime subscriber

  # 246078 13-Aug-2009 15:41
Send private message

The Javascript cannot pass the information directly to the database, but it can call an API of some sort (PHP script for example) that then inputs the information into the database (or updates a file on the server).




"Roads? Where we're going, we don't need roads." - Doc Emmet Brown



78 posts

Master Geek


  # 246101 13-Aug-2009 15:54
Send private message

Hi thanks for the quick response.

So how would you go about doing this? I'm not very familiar with php. Would you be able to explain it a bit further if that's ok? (or post a tutorial link on this)

Thanks again.

 
 
 
 


Professional yak shaver
1599 posts

Uber Geek
+1 received by user: 8

Trusted
BitSignal
Lifetime subscriber

  # 246106 13-Aug-2009 15:59
Send private message

Your best bet is to try and find a good programming book (Google O'Reilly books for some good ones) and study those before attempting any code if you never touched programming before.




"Roads? Where we're going, we don't need roads." - Doc Emmet Brown



78 posts

Master Geek


  # 246111 13-Aug-2009 16:02
Send private message

Fair enough. I have programmed before (mainly Java) and I have been exposed to php to a much lesser degree... but your answer helps. Thanks again :)

58 posts

Master Geek


  # 246142 13-Aug-2009 17:03
Send private message

I think what you are after is AJAX (Asynchronous Javascript And Xml) - this is possible. Google Bing around for some tutorials.

94 posts

Master Geek


  # 246267 13-Aug-2009 20:38
Send private message

Take a look at DWR (Direct Web Remoting)... it's an easy to use AJAX framework for JavaScript and Java. You can download a webapp with examples. Obviously it helps if you're familiar with J2EE (servlet API) and JDBC for your database access.

http://directwebremoting.org/dwr/index.html



78 posts

Master Geek


  # 246325 13-Aug-2009 22:32
Send private message

Awesome, thanks heaps for your answers guys :)

 
 
 
 


96 posts

Master Geek


  # 246437 14-Aug-2009 09:39
Send private message

Ajax --- whould be the best and the easyest way to go about it. If you have Microsoft Visual studio you can get and Ajax toolkit for it from asp.net



78 posts

Master Geek


  # 246645 14-Aug-2009 15:57
Send private message

Yep you guys are right. I believe Ajax is what I need.

Thanks again guys :)

8033 posts

Uber Geek
+1 received by user: 390

Trusted

  # 246702 14-Aug-2009 16:53
Send private message

Use a database imo, you will inevitably have concurrency problems if two people try and change the same file at the same time with a single file based approach.

The traditional way web apps are done is that you have an html form with input fields (texboxes, buttons etc) defined in your html page, the action of this form when you click the button does a http post to the server and the server does processing.

The ajaxy way is to handle the button click in javascript and prevent the default action of posting an html form to the server and instead call a webservice or page to do the processing asynchronously either by a http GET or http POST.

There are heaps of different ways to implement this :)


27 posts

Geek


  # 255318 13-Sep-2009 10:04
Send private message

Hey mate,
If you have previous experience in Java then maybe C# (Microsoft.Net) or Jsp would be a little more familiar to learn than PHP. Any entry level ASP.Net book will have examples on how to implement something straight-forward like this. Ragnor's advice is spot on, there are loads of free simple databases that are very easy to use in Visual Studio (MySql, Ms Sql-Express etc).

Hey if you're keen you could learn Silverlight instead of Asp.Net ;-)

Cheers
Ben

Create new topic



Twitter and LinkedIn »



Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Dunedin selects Telensa to deliver smart street lighting for 15,000 LEDs
Posted 18-Jul-2019 10:21


Sprint announces a connected wallet card with built-in IoT support
Posted 18-Jul-2019 08:36


Educational tool developed at Otago makes international launch
Posted 17-Jul-2019 21:57


Symantec introduces cloud access security solution
Posted 17-Jul-2019 21:48


New Zealand government unveils new digital service to make business easier
Posted 16-Jul-2019 17:35


Scientists unveil image of quantum entanglement
Posted 13-Jul-2019 06:00


Hackers to be challenged at University of Waikato
Posted 12-Jul-2019 21:34


OPPO Reno Z now available in New Zealand
Posted 12-Jul-2019 21:28


Sony introduces WF-1000XM3 wireless headphones with noise cancellation
Posted 8-Jul-2019 16:56


Xero announces new smarter tools, push into the North American market
Posted 19-Jun-2019 17:20


New report by Unisys shows New Zealanders want action by social platform companies and police to monitor social media sites
Posted 19-Jun-2019 17:09


ASB adds Google Pay option to contactless payments
Posted 19-Jun-2019 17:05


New Zealand PC Market declines on the back of high channel inventory, IDC reports
Posted 18-Jun-2019 17:35


Air New Zealand uses drones to inspect aircraft
Posted 17-Jun-2019 15:39


TCL Electronics launches its first-ever 8K TV
Posted 17-Jun-2019 15:18



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.