update input content in editor when another change
update input content in editor when another change

Sorry... question was not posted in the correct discussion
Hello
I try to update a select content in editor when another select change event occurs.
$('select', editor.field('documents.Operation').node()).change(function() {
$.ajax ({
url: 'ajax_lots.php',
method: 'GET',
data: {OpID: editor.field('documents.Operation').val()},
dataType: 'json',
success: function ( data ) {
editor.field('documents.Lot').update( data )
}
})
})
ajax_lots.php :
<?php
include( "../lib/DataTables.php" );
if(isset($_GET['OpID'])) $filter = $_GET['OpID'];
$Sql="(SELECT '' as 'value', '' as 'label') UNION (";
$Sql.="SELECT DISTINCT `ID` as 'value', `Numero` as 'label' FROM `lots` ";
if($filter) $Sql.= "WHERE `Operation` ='".$filter."'";
$Sql.= " ORDER BY `Numero`) ";
$data = $db
->sql($Sql)
->fetchAll();
when change event occurs, the php is launched
if I var_dump $data,at the end of php file called, the values are correct
But I never can get the value returned (XHR tell 'this request has no response avalaible') outside the php file.
I do not understand why...
Is fetchAll() the correct way to set the values?
Please help
This discussion has been closed.
Replies
I looks like you might be missing one thing only - returning the data from the PHP script. Try adding:
Allan
Hi allan
Just one line and all is better...
I feel so alone when searching up to 2 days where was the issue...
Thanks a lot
Heh - we've all been there. Welcome to the club
.
Allan