1
When I try to take value out of ajax, it loses value because?
var url = window.location;
var id = url.toString().split("=")[1];
var nomeResponsavel = "",nomeEmpresa = "" ,emailEmpresa,telefone,site,rua,numero, bairro,estado,cidade,cep;
$.ajax({
type: 'POST',
url: 'load-data.php?id='+id,
dataType: 'text',
success: function(data) {
msg = data;
var values = $.parseJSON(msg);
nomeEmpresa = values[0].razao_social;
emailEmpresa = values[0].email_comercial;
telefone = values[0].tel_comercial;
site = values[0].siteweb;
rua = values[0].end_logradouro;
numero = values[0].end_numero;
bairro = values[0].end_bairro;
estado = values[0].end_eatado;
cidade = values[0].end_cidade;
cep = values[0].end_cep;
nomeResponsavel = values[0].nome;
},
error:function(e){
console.log(e)
}
});
alert(nomeResponsavel);
Total page code
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
require_once("cabecalho.php");
?>
</head>
</html>
<body>
<!-- /. WRAPPER -->
<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
<!-- JQUERY SCRIPTS -->
<script src="assets/js/jquery-1.10.2.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- METISMENU SCRIPTS -->
<script src="assets/js/jquery.metisMenu.js"></script>
<!-- CUSTOM SCRIPTS -->
<script src="assets/js/custom.js"></script>
<script type="text/javascript">
var url = window.location;
var id = url.toString().split("=")[1];
var nomeResponsavel = "",nomeEmpresa = "",emailEmpresa,telefone,site,rua,numero, bairro,estado,cidade,cep;
$.ajax({
type: 'POST',
url: 'load-data.php?id='+id,
dataType: 'text',
success: function(data) {
msg = data;
var values = $.parseJSON(msg);
nomeEmpresa = values[0].razao_social;
emailEmpresa = values[0].email_comercial;
telefone = values[0].tel_comercial;
site = values[0].siteweb;
rua = values[0].end_logradouro;
numero = values[0].end_numero;
bairro = values[0].end_bairro;
estado = values[0].end_eatado;
cidade = values[0].end_cidade;
cep = values[0].end_cep;
nomeResponsavel = values[0].nome;
},
error:function(e){
console.log(e)
}
});
var myUrl = encodeURIComponent("http://ecoprintq.com/index.php/partnerApplication/create");
var dados = "User_full_name:"+nomeEmpresa+"&User_institution:sssss"
$.ajax({
url: "webproxy.php?url=" + myUrl,
data: dados,
crossDomain:true,
type: "GET",
timeout: 30000,
dataType: "text", // "xml", "json"
success: function(data) {
//window.location.href = "webproxy.php?url=" + myUrl + "&" + dados;
},
error: function(jqXHR, textStatus, ex) {
alert(textStatus + "," + ex + "," + jqXHR.responseText);
}
});
</script>
Actually, I wanted to take this ajax value and send it to another ajax, only it sends.
– Gabriel falieri
I even put the full code of the page. I wanted to take the value I get from an ajax and send to another ajax
– Gabriel falieri
Using this example you can put the new upload inside the function
fazer_o_suposto_com_este_valor
, who currently has only Alert but can process whatever you want there... Place a new order including @Gabrielfalieri– Miguel
thanks my dear, gave it right
– Gabriel falieri
@Gabrielfalieri nothing. I’m glad you solved
– Miguel
Dude, you have to, when sending, as if it were a post, just fill out the cross-Omain form?
– Gabriel falieri
'Cause there’s a captcha in this form that I’m sending the information, and the captcha is feeding me
– Gabriel falieri