<script>
$(document).ready(function(){
$('#test').mouseover(function(){
$('#test').ajaxForm({
beforeSubmit: ShowRequest,
success: SubmitSuccesful,
error: AjaxError
});
});
});
function ShowRequest(formData, jqForm, options) {
$("#loading").show();
return true;
}
function AjaxError() {
}
function SubmitSuccesful(responseText, statusText) {
$(function() {
var array=['ravi','abhi','raj','amol','neha','snehal','skksldfjsfsdfddsf','dkfks'];
// add loading image to div
$(function() {
$("#test").attr('title',array.join('<br/>'));
$("#test").tooltip({
content:function(){return $(this).attr('title');},
position: {
my: "center bottom-20",
at: "center top",
using: function( position, feedback ) {
$( this ).css( position );
$( "<div>" )
.addClass( "arrow" )
.addClass( feedback.vertical )
.addClass( feedback.horizontal )
.appendTo( this );
}
}
});
});
});
}
</script>
<div id="loading"></div>
<p>Ravi, Raj and <a href="#" id="test" title="enable to load">5 more</a></p>
「UncaughtTypeError:Object [objectObject]にはメソッドajaxFormがありません...必要な変更を教えてください... ajax呼び出しリストが成功すると、リストが表示されます......」という1つのエラーが表示されます。 。これを解決する方法はありますか?
.ajaxForm()
ネイティブのjquery関数ではありません。を使用するには、外部jsライブラリを含める必要があります.ajaxForm()
。そして重要なことは.ajaxForm()
、htmlform
要素で動作することです。HTMLコードにフォームが表示されません。アンカーにajax呼び出しを使用する場合は、関数で.ajax()ネイティブ関数を使用するだけ.mouseenter
です。
サンプル:
$.ajax({
url: "test.html",
context: content
}).done(function() {
// add code here to execute after ajax call
});
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加