Using Jquery Ajax with External Form to do "live edits" but database Table does not update

Permalink
Here's a demo of what I'm trying to do:
http://www.9lessons.info/2011/03/live-table-edit-with-jquery-and-aj...

I can get everything to work, the post gets sent, except it doesn't arrive or maybe is not processed by the action method I put in the controller, so the database table does not update and the view page does not stay rendered with the edits.

I am using a custom table that I created with PHPmyadmin.

In the view file where the javascript is I am using:
$.ajax({
type: "POST",
url: "<?php echo $this->action('save_sts_in_basic_dict') ?> " ,

In the controller I have:
public function action_save_sts_in_basic_dict () {
$stID = $this->post('stID');
...

Is there a flaw in my thinking this should work with External Forms?
Can someone help me resolve this?

 
CBknits replied on at Permalink Reply
EDIT: the line above got cut off somehow, this is what it should have said

url: "&lt?php echo $this->action('save_sts_in_basic_dict') ?> " ,
JohntheFish replied on at Permalink Reply
JohntheFish
For your table, the best way to create in a C5 way is a db.xml file, either with your block or in a containing package.

For diagnostics, recording using the network facility of Chrome 'inspect element' is my personal favourite for watching the ajax go back and forth. That would help you pin down where it is getting lost.

Personally, within the view and js I prefer to echo simple constants set in the controller (although this is not a rule I strictly follow):
<?php
// usually do this bit in the controller
$this->set('my_action_name', code-to-make-action-url);
?>
...
...
// now in the view - a diagnostic
echo '<pre>'.$my_action_name.'</pre>';
...
<script>
var my_action_name = '<?php echo $my_action_name;?>';
// a diagnostic to make sure it is set:
alert (my_action_name);
...
$.ajax({


[EDIT]
$.ajax is the most primitive ajax methods of jquery. $.post or $.load are much easier to use.
CBknits replied on at Permalink Reply
Thank you for your tips Johnthefish-- exactly what I needed.
I will give it a try later today.