I
I
Intelix2019-05-09 20:52:38
phonegap
Intelix, 2019-05-09 20:52:38

How to send queries to the database from webview application?

Hello, maybe a stupid question, but asking it is the fastest way to figure it out.
I am learning to create an android webview application (using cordova) and I have a need to tie a database to the application.
The question is: How can I do this, because the application is not hosted, php + mysql here, as I understand it, will not work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Intelix, 2019-05-12
@Intelix

You need to use AJAX requests, because. php files cannot be executed inside a cordova application. Here is an example:

$(document).ready(function() {
  $('#singup').submit(function(e){
    e.preventDefault();
    $.ajax({
      type: 'POST',
      url: 'singup.php', //тут ссылка на файл на сервере 
      data: $(this).serialize(),
    }).done(function() {
        alert("Успешно!");
    });
    return false;
  });
});

The singup.php file contains the required php code, and the file itself is respectively located on the server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question