Update database with javascript


















Improve this question. Alan Coromano. Alan Coromano Alan Coromano 23k 46 46 gold badges silver badges bronze badges. There's your rough answer. Now give it a try, and if you get stuck on something specific, ask about that.

Would you mind giving me an example? Show 7 more comments. Active Oldest Votes. For example, if you can pass a field array to the parser function; you can set the order of the fields and leave out a field or two if you want to: loadTable 'data-table', ['field1', 'field2', 'field3'], jsonData ; Notice that field4 is not parsed.

Calling dt. Updated fiddle here. Improve this answer. Show 1 more comment. You can iterate through your JSON objects. Prasad Rajapaksha Prasad Rajapaksha 5, 10 10 gold badges 35 35 silver badges 51 51 bronze badges. Well you are going to have to post back the page to the server since that is the only way you can do it. You probably be better off transfering them to another page or showing a different user control on the page instead of using window.

Plus you can make it look nicer that that windowed element. Thanks for the reply. Is it possible to do that in javascript? If so, could you point me in the right direction? Recordset" ; rs. Output 2 Enter an employee id in the TextBox that you want to update in the database and then enter the new employee name in the TextBox.

Then click on the "Update" button. Output 3 After updating the record, click on the "Show All Record" button. You will see a record updated successfully.

Output 4 If you will click on the Update button without entering a value into the TextBox then it will show the error: For more information, download the attached sample application.

To do that, you use javascript to issue an asyncronous call ajax to a php file, which in turn runs the query to update the db, and returns a response to the javascript. Then you use that response to update the user interface. It's not safe to expose the query in javascript, so make sure the query itself is in the php file. I personally recommend using jQuery's Ajax utilities for easy, cross-browser ajax.

AJAX is the answer. I recommend using jQuery or Mootools to do it, they make it easier by several orders of magnitude. Anyway, the way to do it is to set up a rating PHP script. It accepts an item and a rating via POST data, and uses that data to call the database. Be sure to check the authenticity of the user. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.

Learn more.



0コメント

  • 1000 / 1000