Note that there are some explanatory texts on larger screens.

plurals
  1. POmail() Prevents JSON Reponse
    primarykey
    data
    text
    <p>I am using the following jQuery code to send form data to a PHP handling script which either enters a new listing in a data base or updates an existing listing.</p> <p>The site lists boats and yachts for sale. It is/was working great, but now the client wants to get a email notice when a new boat is listed. I added code to the PHP handling script to do that, but if I use <code>mail()</code> for some reason it stops the success function from working in the jQuery code below.</p> <p>The <code>mail()</code> function is the only thing that effects it. If I comment that line out it works again.</p> <p>Any ideas of what is happening?</p> <pre><code>$.ajax({ type: "POST", url: "scripts/listing_form_json_exec.php", dataType: 'json', data: JSON.stringify(dataString), success: function(data) { var yacht_id = (data); $('#manage_images_link').attr('href', 'manage_images.php?yacht_id=' + yacht_id); $('input[name=yacht_id]').val(yacht_id); $('img.saved').show(); $('img.saved').fadeOut(3000); $('div#button_frame').show(); $('#errors_container').html(''); } }); </code></pre> <p>EDIT</p> <p>The PHP script is very long, but here is the offending part</p> <pre><code> $_SESSION['SESS_YAUCHT_ID'] = $yacht_id; echo json_encode($yacht_id); if (isset($message)) { //mail($to, $subject, $message, $headers); } </code></pre> <p>I tried putting the <code>mail()</code> function in different places, but no matter where I put it the same thing happens. Above I have the <code>mail()</code> function commented out and everything works. If I uncomment it the script stops working.</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.
    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