0
Guys I want to search a string in a PHP file called search.php I want to return a string to my index.php but I want to do this when calling the function try_it(), is there any way to do this with jQuery? I don’t want index.php to update the page, only the value of the variable that will be returned by the search.php
index php.
<html>
<head>
<title>teste</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<body>
<button class="btn btn-default" id="executar" onclick="buscar()" type="button">Buscar</button>
<script>
var stringDoPHPvemPraCa;
function buscar(){
//quero que a string do php seja setada em stringDoPHPvemPraCa no momento em que eu chamar essa funcao
}
</script>
</body>
</html>
php search.
include 'config.php';
include 'database.php';
include 'connection.php';
$pesquisa = DBSearch("usuarios","WHERE id = 1","questoes_resolvidas"); // isso me retorna um array
// com as questões resolvidas onde "usuarios" é a tabela "WHERE id = 1"
// é o parametro e "questoes_resolvidas" é o campo a ser retornado (a string em si)
$pesquisa[0]['questoes_resolvidas'] //isso que eu quero no index.php
Post the codes so we can help
– Guerra
OK I’ll do it, just a moment
– Daniel Santos
Take a look in this tutorial. The list you simply upload in the foreach of your bank, doing a like.
– Ivan Ferrer