0
我正在運行一個post函數,然後函數結束。我正在運行另一個功能。問題是第二個功能不起作用,如果我沒有在功能的警報消息,它不運行...如果警報被註釋掉,jquery功能不能正常工作
jQuery的功能是:
function applyeditable(){
//alert('trying to apply editable class...');
$(".edit_mystatus").editable('/cgi-bin/my_cgi_script.pl', {
event : 'dblclick', //or dblclick
data : " {'A':'Active','C':'Completed','D':'Deleted'}",
type : 'select',
submit : 'Ok',
indicator : '<img src="http://my_website/images/indicator.gif">',
placeholder : 'Double Click to Edit',
tooltip : 'Double Click to edit...',
style : 'display: inline',
name : 'name',
id : 'id',
callback : function(value, settings) {
// console.log(this);
// console.log('returned value= '+value+' we have to now disable rest of form if Completed or Deleted');
// console.log(settings);
}
});
$(".edit_mynotes").editable('/cgi-bin/my_cgi_script.pl', {
event : 'dblclick', //or dblclick
type : 'textarea',
rows : 10,
cols : 100,
cancel : 'Cancel',
submit : 'Save',
indicator : '<img src="http://my_website/images/indicator.gif">',
placeholder : 'Double Click to enter text',
tooltip : 'Double Click to edit...',
style : 'display: inline',
name : 'name',
id : 'id'
});
$(".ajaxfileupload").editable('/cgi-bin/my_cgi_script.pl', {
type : 'ajaxupload',
submit : 'Upload',
cancel : 'Cancel',
indicator : '<img src="http://my_website/images/indicator.gif">',
tooltip : "Double Click to upload...",
style : 'display: inline',
name : 'filename',
id : 'id'
});
$(".checkclass").click(function() {
var $this = $(this);
// $this will contain a reference to the checkbox
var chkboxval = $this.val();
if ($this.is(':checked')) {
alert('the checkbox was checked val='+chkboxval);
} else {
alert('the checkbox was UNchecked val='+chkboxval);
}
});
}
HTML是:
<input type="checkbox" class="checkclass" value="1_0">
<input type="checkbox" class="checkclass" value="1_1">
<input type="checkbox" class="checkclass" value="1_2">
...
歡迎的奇妙世界** **異步!你不能那樣做。 – SLaks
它可能工作得很好,你只是遇到異步的意思, – adeneo
當警報被解僱..它只是給了一些時間來完成請求..這是你覺得它有效的唯一原因當有一個警報 –