javascript - Laravel with Jquery - Ajax Throwing 500 Error - Prob with Server Side -



javascript - Laravel with Jquery - Ajax Throwing 500 Error - Prob with Server Side -

. hello y'all. trying gather few variables , send controller. maintain getting 500 error , can't figure out i'm going wrong other i'm pretty sure server side. pointers went wrong or improve practices appreciated! give thanks yall much!

route:

/*ajax edit cost on cost page*/ route::post('edit_price', array( 'as' => 'edit_price', 'uses' => 'pricecontroller@edit_price' ));

controller:

public function price_edit(){ console.log($id_and_db); }

js:

/*ajax edit prices*/ $(document).ready(function(){ $('.edit_button').click(function(e){ e.preventdefault(); var id_and_db = $(this).prop('name').replace('edit', 'newprice'), new_price = $('[name=' + id_and_db + ']').val(); $('#test').val(id_and_db); $.ajax({ url: 'edit_price', type: "post", data: { "id_and_db": id_and_db, "new_price": new_price, }, success: function(data){ $("#edit_results").html(data); $("#edit_results").addclass('panel callout radius'); console.log(data); }, error: function(xhr, status, error){ console.log(xhr); console.log(status); console.log(error); }, }); }); });

error message:

post http://localhost/local/example/public/edit_price 500 (internal server error) jquery.min.js:4 xhr finished loading: post "http://localhost/local/example/public/edit_price". jquery.min.js:4 object {readystate: 4, getresponseheader: function, getallresponseheaders: function, setrequestheader: function, overridemimetype: function…} price_index_admin.js:40 error price_index_admin.js:41 internal server error

you did

'uses' => 'pricecontroller@edit_price'

but controller method price_edit().

try alter controller method to

public function edit_price() {

javascript php jquery ajax laravel-4

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -