Advertisement
fandyindra

Untitled

Feb 28th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. ================Ini route==================
  2. Route::post('/post-product-catalog/upload','PengajuanProdukController@upload');
  3.  
  4.  
  5. ===============Ini controller laravel==============
  6. public function upload(Request $request)
  7. {
  8.  
  9. $data = $request->all();
  10. Log::debug($data);
  11. return response()->json([
  12. "status" => "OK",
  13. "upload" => $data,
  14. ]);
  15.  
  16. }
  17.  
  18.  
  19.  
  20. ================Ini controller js==================
  21. $scope.upload = function ()
  22. {
  23. $("form#uploadImage").submit(function(event){
  24.  
  25. event.preventDefault();
  26. var formData = new FormData($(this)[0]);
  27.  
  28. $.ajax({
  29. url: '/supplier/post-product-catalog/upload',
  30. type: 'POST',
  31. data: formData,
  32. async: false,
  33. cache: false,
  34. contentType: false,
  35. processData: false,
  36. success: function (response) {
  37.  
  38. }
  39. });
  40.  
  41. return false;
  42. });
  43.  
  44. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement