I've broken my own jQuery Ajax update table :(
I'm pretty sure its how I'm referring to jQuery (I'm a javascript noob). I'm using Railo(CFML) with a bootstrap framework and the x-editable plugin. I'm dynamically outputting the table and each cell within the table should be Ajax editable.
<cfoutput query="the_table">
<tr id="gererated_table">
<!--- Looping through and dynamicly displaying content rows of the table with ajax editing --->
<cfloop array="#column_ids#" index="i" <!--- from="1" to="#howmany_cols.total_cols#" --->>
<cfset colmun = "col#i#">
<td><a class="ajax_update" name="#session.tblname#" data-name="col#i#" data-pk="#id#" data-type="text" data-url="ajax/ajax_textfield.cfm?table=#session.tblname#" data-thetable="#session.tblname#" data-placement="right" >#evaluate(colmun)#</a></td>
</cfloop>
<td><a href="table_row_delete.cfm?id=#any_tables.ID#&rowid=#id#" class="btn btn-danger" type="button">Delete Row</a></td>
</tr>
</cfoutput>
But after I click edit and submit, it then errors on my ajax page:
ERROR: key [VALUE] doesn't exist in struct (keys:id,fieldnames,col3,thetable)
Here is my jQuery snip at the bottom of my page:
<script type="text/javascript">
$(document).ready(function () {
// These start the Java Function for the inline table editing
$('.ajax_update').editable({
params: function(params) { //params already contain `name`, `value` and `pk`
var data = {};
data['id'] = params.pk;
data[params.name] = params.value;
data ['thetable'] = "";
return data;
}
});
$.fn.editable.defaults.mode = 'inline';
});
</script>