jqueryを使用した簡単なAjax呼び出しがあります。
jQuery(".deletebutton").on("click", function() {
if (confirm("Are you sure you want to delete?"))
{
jQuery.ajax({
url: 'index.php?option=com_recordings&task=deletevideos&format=raw',
type: "POST",
success: function(data){
console.log("anything?"); //never get here with FF and Chrome
if (data == 'blah')
{
alert("success"); //only with IE
}
}
});
}
});
Joomlaコンポーネント開発を使用しているため、URLがおかしいです。これは基本的に、。を持つファイルを指しますecho "blah";
。htmlは、クラスを持つ単なるボタンdeletebutton
です。
IEでは、このコードは正常に機能し、アラートが発生します。FFとChromeでは機能しません。ショーをチェックすると、 jqXHR.status
0が返されることがわかります。Firebugには、ここで問題を指摘するものは何もありません。何が起こっているのか分かりますか?
編集:私はそれが私のhtmlボタンと関係があることに気づきました。現在のボタンはフォーム内にあります。
<form name="myform" action="">
<table id="webcam-table" class="pretty">
<thead>
<tr>
<th>Camera Name</th>
<th>Date Created</th>
<th>Video Size</th>
<th>Video Length</th>
<th>
<input type="checkbox" name="checkboxselectall" title="Select All" />
<button class="deletebutton" title="Delete the selected videos" >Delete</button>
... //a table with checkboxes (for the form) and other stuff
</form>
しかし、このフォームの外に単純なボタンを作成すると、ajax呼び出しは期待どおりに機能します。ここで何が起こっているのですか?