Proper Value to Return to success function from program
This is the ajax function I've been working with - it works fine, all data is being sent back, parsed and written into the correct databases
-
- <script type="text/javascript">
- $(function()
- {
- $('#submitButton').click(function(){
- var reservations = $("#main_table table input[name=name]:checked").map(function() {
- row = $(this).closest("tr");
- return {
- recordid : $(row).find('input[name=record_id]').val(),
- firstname : $(row).find('input[name=firstname]').val(),
- lastname : $(row).find('input[name=lastname]').val(),
- timeneeded : $(row).find('input[name=timeneeded]').val(),
- dateneeded : $(row).find('input[name=dateneeded]').val(),
- pickup : $(row).find('input[name=pickup]').val(),
- dropoff : $(row).find('input[name=dropoff]').val(),
- pxdriver : $(row).find('td:eq(7)').text()
- }
- }).get();
- console.log(reservations);
- infotosend = JSON.stringify(reservations);
- $.ajax({
- type: "POST",
- url: "create_assignments.php",
- data: {data : infotosend},
- dataType: 'json',
- cache: false,
- timeout: 100000,
- success: function (data) {
- console.log("SUCCESS : ", data);
- },
- error: function (e) {
- console.log("ERROR : ", e);
- }
- });
- });
- });
- </script>
- When I look at the console output, it shows status:200, statusText="OK", but it also shows that it has returned to the error:function and throws ERROR to the console. What am I missing? I've been trying to go through the API documentation and am building a better knowledge base, but I can't seem to find this answer.
- Thank you