Sto cercando di inviare i dati del modulo alla pagina corrente per la gestione delle variabili usando jQuery. Quando invio la richiesta POST, il server riceve una richiesta GET e il mio URL cambia per corrispondere a GET. Capisco che jQuery si trasforma automaticamente in una richiesta GET se non utilizzo implicitamente type: "POST"
, ma è quello che credo stia facendo. Qualsiasi aiuto sarebbe apprezzato.jQuery AJAX POST si trasforma in GET
<script>
function addadomain(){
$.ajax({
type: "POST",
url: "domains.php",
data: $("#domainform form").serializeArray(),
success: function() {
$("#domainlist").load("domains.php #domainlist");
$.ajaxSetup({ cache: false });
}
});
return false;
};
</script>
<a id="displayText" href="#" onclick="toggle();" >Add Domains</a>
<div id="toggleText" style="display: none">
<form name="adddomain" id="domainform" autocomplete="on">
<input type="hidden" name="userid" id="userid" value="<?PHP echo $loggedInUser->user_id; ?>" />
Domain: <input type="text" name="domain" id="domain" required="required" /><br />
Keyword: <input type="text" name="keyword" id="keyword" required="required" /><br />
Facebook Url: <input type="text" name="facebook" id="facebook" /><br />
Twitter Url: <input type="text" name="twitter" id="twitter" /><br />
Analytics ID#: <input type="text" name="analytics" id="analytics" /><br />
Blogspot Url: <input type="text" name="blogspot" id="blogspot" /><br />
<input type="submit" onclick="addadomain()" id="submit" value="submit" />
</form>
</div>
Non c'è forma dentro #domainform ... – thebjorn