j is undefined

j is undefined

RazorphynRazorphyn Posts: 5Questions: 0Answers: 0
edited August 2013 in DataTables 1.9
Hi,
this is the first time that I see this error and I can't find a solution:
[code]
var request = $.ajax({
type: "POST",
url: "../php/admin_function.php",
data: {
act: "retrive_faq"
},
dataType: "json",
success: function (a) {
if ("ret" == a.response || "empty" == a.response) {
if ("ret" == a.response) {
var b = a.faq.length;
for (i = 0; i < b; i++) {
a.faq[i].action = ''
}
}
$("#loading").remove();
$("#faqtable").dataTable({
sDom: "<<'span6'l><'span6'f>r>t<<'span6'i><'span6'p>>",
sWrapper: "dataTables_wrapper form-inline",
bProcessing: !0,
aaData: a.faq,
oLanguage: {sEmptyTable: "No FAQs"},
aoColumns: [
{sTitle: "Id",mDataProp: "id",sWidth: "60px"},
{sTitle: "Question",mDataProp: "question"},
{sTitle: "Postion",mDataProp: "position",sWidth: "50px"},
{sTitle: "Active",mDataProp: "active",sWidth: "60px"},
{sTitle: "Rate",mDataProp: "rate",sWidth: "40px"},
{sTitle: "Toogle",mDataProp: "action",bSortable: !1,bSearchable: !1,sWidth: "60px"}
]
});
} else {
noty({text: a[0],type: "error",timeout: 9E3})
}
}
});
request.fail(function (a, b) {noty({text: b,type: "error",timeout: 9E3})});
[/code]
I can delete any row but I can only update the first one, the others(second and so on) return an error: `TypeError: j is undefined` and so I can't update the row with this code:
[code]
$(document).on('click','.submit_changes',function(){
var dom=$(this).parent();
var id= $("#faq_edit_id").val();
var pos= $("#faq_edit_pos").val();
var q= $("#edit_faq_question").val().replace(/\s+/g,' ');
var p= $("#edit_faq_position").val();
var ac= $("#activedep").val();
alert(pos);
<?php if(!$isMob) { ?>
var a=CKEDITOR.instances.edit_faq_answer.getData().replace(/\s+/g," ");
<?php }else { ?>
var a=editora.getValue().replace(/\s+/g,' ');
<?php } ?>
if(q.replace(/\s+/g,'')!='' && a.replace(/\s+/g,'')!=''){
var request= $.ajax({
type: 'POST',
url: '../php/admin_function.php',
data: {act:'edit_faq',id:id,question:q,answer:a,active:ac,position:p},
dataType : 'json',
success : function (data){
if(data[0]=='Succeed'){
var action='';
ac=(ac==1)? 'Yes':'No';
var mu={id:id,question:q,position:data[1],active:ac,rate:'Unrated',action:action};
$('#faqtable').dataTable().fnUpdate(mu,pos);
$('#faq_div').slideToggle(600);
$('#edit_faq').removeClass('open');
}
else
noty({text: data[0],type:'error',timeout:9000});
}
});
request.fail(function(jqXHR, textStatus){noty({text: textStatus,type:'error',timeout:9000});});
}
else
noty({text: 'Form Error - Empty Fields',type:'error',timeout:9000});
});
[/code]
What am I doing wrong?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Link to a test case please: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
  • jhcomputejhcompute Posts: 26Questions: 0Answers: 0
    Hello,

    Datatables require PHP 5.2 or newer for JSON. I had a similar problem and when I updated my server, no problem.

    Might just double check this.

    Cheers...
  • RazorphynRazorphyn Posts: 5Questions: 0Answers: 0
    edited August 2013
    Hi, I'm sorry, this is the page:
    http://razorphyn.com/products/support/
    Login: admin@admin.com
    Admin

    Once you have logged in go to Administration-> FAQs Managment

    This isn't the first page where I'm using datatables, but it's the only one that gives me this error
  • RazorphynRazorphyn Posts: 5Questions: 0Answers: 0
    Now I have to delete the row and reinsert the updated row
This discussion has been closed.