Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX fully functional, yet still shows the error message
    primarykey
    data
    text
    <p>In 3 different AJAX scripts that I have written the error message is displayed even though the ajax is processes the PHP file updated and all the success statements are executed. Since I only discovered ajax a few days ago. There must be something wrong with my scripts. Perhaps someone could see where I have gone wrong.</p> <p>AJAX:</p> <pre><code>function bookingdetails() { var actdate = $('#actdate').val(); var airport = $('#FLTairport').val(); var number = $('#FLTnumber').val(); var time = $('#FLTtime').val(); var dataString = 'actdate=' + actdate + '&amp;airport=' + airport + '&amp;number=' + number + '&amp;time=' + time; $.ajax({ type: 'POST', url: '&lt;?php echo $thisposturl;?&gt;?update', data: dataString, beforeSend: function() { $('#airloader').html('&lt;img id="BKloader" src="http://www.divethegap.com/update/z-images/structure/icons/blockloader.gif" alt="" width="30" height="30"/&gt;'); }, error: function() { $('#airloader').html('arse up'); }, dataType:'json', success: function(data) { $('#actdate').val(data.date); $('#FLTnumber').val(data.FLTnumber); $('#airloader').html('marvellous'); $('#FLTairport').val(data.FLTairport); $('#FLTdate').val(data.FLTdate); $('#FLTtime').val(data.FLTtime); $('#datediv').load('&lt;?php echo $thisposturl;?&gt; #datediv'); } }); } </code></pre> <p>PHP : (dont worry about the insert post bits)</p> <pre><code>&lt;?php function __update_post_meta( $post_id, $field_name, $value = '' ) { if ( empty( $value ) OR ! $value ) { delete_post_meta( $post_id, $field_name ); } elseif ( ! get_post_meta( $post_id, $field_name ) ) { add_post_meta( $post_id, $field_name, $value ); } else { update_post_meta( $post_id, $field_name, $value ); } } if ( is_user_logged_in() ) { $my_post = array( 'ID' =&gt; get_the_ID(), 'post_date' =&gt; $_POST['actdate'], ); $the_post_id = wp_update_post( $my_post ); __update_post_meta( $the_post_id, 'FLTairport', $_POST['airport'] ); __update_post_meta( $the_post_id, 'FLTnumber', $_POST['number'] ); __update_post_meta( $the_post_id, 'FLTtime', $_POST['time'] ); } $FLTdate = get_the_time('d/m/Y'); $actdate = get_the_time('Y-m-d'); $FLTairport = $_POST['airport']; $FLTnumber = $_POST['number']; $FLTtime = $_POST['time']; echo json_encode( array('FLTdate'=&gt;$FLTdate, 'actdate'=&gt;$actdate, 'FLTairport'=&gt;$FLTairport, 'FLTnumber'=&gt;$FLTnumber, 'FLTtime'=&gt;$FLTtime)); ?&gt; </code></pre> <p>Result all values are updated but it still displays 'arse up' in the #airloader. This is one example I can provide it with 3 out of 4 of the ajax scripts that I have written.</p> <p>Any ideas?</p> <p>Marvellous </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload