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

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

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 :)

59 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 :)

8035 posts

Uber Geek

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 »

OPPO Find X2 Lite brings flagship features to mid-range 5G smartphone
Posted 29-May-2020 12:52


Sony introduces the digital camera ZV-1 for content creators
Posted 27-May-2020 12:47


Samsung Announces 2020 QLED TV Range
Posted 20-May-2020 16:29


D-Link A/NZ launches AI-Powered body temperature measuring system
Posted 20-May-2020 16:22


NortonLifeLock Online Banking Protection now available for New Zealand banks
Posted 20-May-2020 16:14


SD Express delivers new gigabyte speeds for SD memory cards
Posted 20-May-2020 15:00


D-Link A/NZ launches Nuclias cloud managed network solution hosted in Australia
Posted 11-May-2020 17:53


Logitech introduces new video streaming solution for home studios
Posted 11-May-2020 17:48


Next generation Volvo cars to be powered by Luminar LiDAR technology
Posted 7-May-2020 13:56


D-Link A/NZ launches Wi-Fi Certified EasyMesh system
Posted 7-May-2020 13:51


Spark teams up with Microsoft to bring Xbox All Access to New Zealand
Posted 7-May-2020 13:01


Microsoft plans to establish its first datacenter region in New Zealand
Posted 6-May-2020 11:35


Genesis School-gen has joined forces with Mind Lab Kids
Posted 1-May-2020 12:53


Malwarebytes expands into privacy with fast, frictionless VPN
Posted 30-Apr-2020 16:06


Kordia to donate TV airtime on Channel 200 to community groups
Posted 30-Apr-2020 16:00



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.