0
ベースのhrefタグを置かないと問題を引き起こすApache mod_rewriteを使用しているため、自分のサイトに<base href="http://www.mysite.com/it/"/>
を使用する必要があります。ベースhrefのjQuery POSTの問題
しかし、問題は今、このjQueryの機能に来ている:上記
$(document).ready(function(){
$("#submit_newsletter").click(function(){
var hasError = false;
var emailReg = /^([\w-\.][email protected]([\w-]+\.)+[\w-]{2,4})?$/;
var nameVal = $("#name").val();
if(nameVal == '') {
$("#name").addClass("highlightError").delay(4000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
hasError = true;
}
var subnameVal = $("#subname").val();
if(subnameVal == '') {
$("#subname").addClass("highlightError").delay(4000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
hasError = true;
}
var emailVal = $("#email").val();
if(emailVal == '') {
$("#email").addClass("highlightError").delay(4000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
hasError = true;
} else if(!emailReg.test(emailVal)) {
$("#email").addClass("highlightError").delay(4000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
hasError = true;
}
var messageVal = $("#message").val();
if(messageVal == '') {
$("#message").addClass("highlightError").delay(4000).queue(function(){
$(this).removeClass("highlightError");
$(this).dequeue();
});
hasError = true;
}
if(hasError == false) {
$.post("mail.php",
{ name: nameVal, subname: subnameVal, email: emailVal, message: messageVal },
function(data){
$("#results").text("Messaggio Inviato.").delay(4000).queue(function(){
$("#results").text("")
$(this).dequeue();
});
$('#newsletter')[0].reset();
}
);
}
return false;
});
});
私はそれを使用する場合、それだけで正常に動作ベースHREFタグを削除
(と私は繰り返しが、私はそれを使用する必要があります) jQuery関数の動作が停止します。 これはエラーを起こさず、単にmail.phpファイルに値を渡さず、結果を返しません。このjQueryの問題をベースhrefタグで修正するにはどうすればよいですか?
ありがとうございました。
ありがとう:あなたはGETメソッドを維持したい場合は
のRewriteRuleは次のようなものでなければなりません。すべては動作しますが、この$( "#results")はありません。( "Messaggio Inviato")。 (this).dequeue(); }); –