javascript - How to update my database after using ajax? -


I am using Javascript / AJAX for the first time, so I am trying to find some great ways.

Right now, in my opinion, I display a figure and then when calls to an external server call one value (in this case the accounts balance). I update the data format.

Now, it is working perfectly, but I am running on an issue. I would like to update my database with the new "balance" also which was found. However, I want to do later that the AJAX call has already been made.

Should I do something like this in Ajax Call? (Which seems wrong) or should I include this update in that php file which is being said?

Here is the view / ajax call:

  & lt; Script & gt; Function getBalance () {$ .get ("property / balance.php", "", function (data) {$ ('# left)'. Html (data); // alert (data);}); } GetBalance (); & Lt; / Script & gt;  

And here is balance.php :

   

I know that the $. Get function is used in this way:

  $. (URL, data, function (data, position, exhaust), datatype)  

Should I take this action where I pass in data?


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -