AJAXを介して動的に作成されたデータをリロードしようとしdiv
ていますが、403forbiddenエラーが発生します。たぶん私がしていることに何か問題があります。助けていただけませんか。前もって感謝します。
HTML:
<div id="curr-elem">
<div class="box-header">
<h3>Elementary Subject</h3>
</div>
<div id="curr-elem-content">
<table id="curr-elem-tble">
</table>
</div>
</div>
jQuery:
var html;
$.ajax({
type: 'POST',
url: 'add_subject.php',
dataType: 'json',
data: { 'func_numbr':'2' },
success: function(data) {
var activator;
var disabler;
var counter_sub = 0 ;
$.each(data, function(i, item) {
if (data[i].subj_status == "0") {
classToAddInactve = "inactiveButton";
DisableInactve = "disabled=\"disabled\""
classToAddActve = "";
DisableActve = ""
}
else {
classToAddInactve = ""
DisableInactve = ""
classToAddActve = "inactiveButton";
DisableActve = "disabled=\"disabled\""
}
html = "<tr>";
html += "<td><lable>Subject: </label><input type='text' name='subject[" + counter_sub + "]' rel='" + data[i].subj_id + "' value='" + data[i].subj_name + "' readonly='readonly'></td>";
html += "<td><input type='button' rel='#loading-window' id='activate[" + counter_sub + "]' name='active' class='button active modal2 " + classToAddActve + "' value='Apply' " + DisableActve + "> ";
html += "<input type='button' rel='#loading-window' id='inactivate["+counter_sub+"]' name='active' class='button inactive modal2 " + classToAddInactve + "' value='Remove from list' " + DisableInactve + "></td>";
html += "</tr>";
$('#curr-elem-tble').append(html);
counter_sub = counter_sub +1;
});
}
});
div
更新をトリガーするJS :
$('.active').live('click', function() {
var prev = $(this).parent().prev().find('input[type=text]');
var valText = $(prev).val();
var relVal = $(this).parent().prev().find('input[type=text]').attr('rel');
var div = $(this).parent().parent().parent().parent().parent().attr('id');
$("[id*="+div+"]").hide();
$.ajax({
type: 'POST',
url: 'add_subject.php',
dataType: 'json',
data: {
'func_numbr': '7',
'subjct_name': valText,
'subjct_id': relVal
},
success: function(data) {
$('#mask2').hide();
$('#loading-window').hide();
$("[id*=" + div + "]").load("[id*=" + div + "]");
}
});
});