Store the function returned value in a database
I am trying to send the value returned by a function to a database using client-server model. I am using Javascript as my client model. How can I connect to a server to send my data to the database.
For example; from the below code, I want to开发者_开发问答 store abc in the database.
<blink>
<html>
<head><script>
var t = "abc";
function test(){
return t;} // RETURNED VALUE WILL BE "abc"
</script></head>
<body onload = "test()">
</body></html>
</blink>
You cannot interface with a database server directly with Javascript. You would need to use some sort of server side script like ASP.NET, PHP, Java, etc.
Reply in answer of your comment concerning AJAX I suggest you have a look at this: https://developer.mozilla.org/en/AJAX
精彩评论