Я разрабатываю мобильное приложение с телефонной связью, и у меня есть form
для регистрации новых пользователей. В broswer (chrome и firefox) форма отлично работает, когда правильно заполняется и показывает ошибки, если что-то не так. У меня есть alert('work!');
в начале функции, чтобы проверить, был ли вызван, в браузерах появляется предупреждение, но в приложении нет. Что может быть? Ps: У меня уже есть <access origin="">
на мой сайт, где находится php-файл формы.форму отправить не называть ajax function phonegap
EDIT:
форма:
<form id="cadastro" method="post">
<input type="text" style="height:30px;margin-bottom:10px;margin-top:10px;font-size:18px" name="nome" id="textinput-2" placeholder="Nome" required>
<input type="text" style="height:30px;margin-bottom:10px;font-size:18px" name="email" id="textinput-1" placeholder="Email" required>
<div id="email_erro"></div>
<input type="password" style="height:30px;margin-bottom:10px;font-size:18px" name="senha" id="password" placeholder="Senha" autocomplete="off" required>
<input type="password" style="height:30px;margin-bottom:10px;font-size:18px" name="repetir_senha" id="re_password" placeholder="Repetir senha" autocomplete="off">
<div id="senha_erro"></div>
<fieldset data-role="controlgroup" style="margin-left:5%" data-type="horizontal" data-mini="true">
<input type="radio" name="sexo" id="radio-choice-c" value="m" checked="checked" required>
<label for="radio-choice-c">Masculino</label>
<input type="radio" name="sexo" id="radio-choice-d" value="f" required>
<label for="radio-choice-d">Feminino</label>
</fieldset>
<div style="margin-left:3.5%;margin-right:4%;">
<input type="checkbox" name="newsletter" id="checkbox-mini-0" value="1" data-mini="true">
<label for="checkbox-mini-0">Quero receber as ofertas e novidades</label>
<input type="checkbox" name="termo" id="checkbox-mini-1" data-mini="true" required>
<label for="checkbox-mini-1">Aceito os Termos de Uso e Política de privacidade</label>
<button type="submit" class="ui-btn ui-shadow ui-corner-all" id="termo" style="float:none;margin-left:2%">Criar conta</button>
</div>
</form>
функция:
<script>
alert('entrou no script');
$('#cadastro').submit(function(){
var valor = $('#cadastro').serialize();
$.ajax({
type: 'POST',
url: 'cadastro',
dataType: "json",
data: valor
}).success(function(response){
alert('retornou função');
if (response.sucesso) {
window.localStorage["email"] = response.dados.email;
window.localStorage["nome"] = response.dados.nome;
window.localStorage["sexo"] = response.dados.sexo;
window.localStorage["id"] = response.dados.id;
//window.localStorage["UID"] = data.uid;
window.location = "logado.html";
} else {
alert("Verifique seus dados");
$('#email_erro').html(response.erro_email);
$('#senha_erro').html(response.erro_repetir_senha);
//window.location("main.html");
}
});
return false;
});
</script>
Можем ли мы видеть соответствующие коды для этого? – andre3wap
Конечно, я отредактировал мое сообщение. –
Включаете ли вы файл java-файла cordova? - – Tricky12