0

Is there any reason why this piece of code returns me an error 500 ?

The error retuned by the inspector is:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) on this file http://example.com/assets/app/php/ajax/try.php

All looks good from here and the 'assets/app/php/ajax/try.php' is here.

'try.php' has a 644 permissions.

Thanks for your help.

<form id="registration">
    <fieldset id="step_1" class="show">
        <div class="row text-left">
            <div class="col-sm-6 mb--1">
                <label>Prénom :</label>
                <input type="text" name="firstName" id="firstName">
            </div>
            <div class="col-xs-12">
                <button type="submit" id="confirm_step1" class="btn btn--primary type--uppercase">Commencer votre essai</button>
            </div>
        </div>
    </fieldset>
</form>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script>

$(document).ready(function(){
    $('#confirm_step1').click(function(e){
        e.preventDefault();

        firstName = $('#firstName');

        var UrlToPass = 'action=register&firstName='+firstName.val();

        $.ajax({
            type : 'POST',
            data : UrlToPass,
            url  : 'assets/app/php/ajax/try.php',
            success: function(responseText){
                var json = $.parseJSON(responseText);
                if(json.type=="success"){
                    ...
                }
                if(json.type=="error"){
                    ...
                }
            }
        })
    })
})
</script>
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339

0 Answers0