Wordpress - is it a good idea to insert data into the database with ajax?
0
I'm making a wordpress plugin, and I need to save some data to the database. The data I need to save is the result of an ajax post request. Which would be the better option, to try to insert it to the database directly with ajax (Which I don't really know how to do and if it is a good option), or to send the data to a php file with another ajax post request, then save it in a php variable and put it into the database? Also is it possible to have both the ajax requests and a php tag on the same file, so when I'm making the new post request I should send it to the file in which it is? Esentially the two post requests would look something like this, and please, feel free to correct me if I'm not doing something properly, I haven't used ajax that much. function getcode(){ var token = localStorage.ge