Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. $('select[id=currency-data]').change(function () {
  2.  
  3. var currency_id = $(this).val();
  4.  
  5. $.ajax({
  6. url: "{{Route('exchange-rate')}}",
  7. type: 'POST',
  8. data: {currency_id: currency_id },
  9. success: function(data){
  10. $('#ex-rate').val(data);
  11. }
  12. });
  13. });
  14.  
  15. {!! Form::label('currency_id', 'Currency:', ['class' => 'control-label']) !!}
  16. {!! Form::Select('currency_id', $currency_data, Input::old('currency_id'), ['id'=>'currency-data','class' => 'form-control','required']) !!}
  17.  
  18. {!! Form::label('exchange_rate', 'Exchange Rate:', ['class' => 'control-label']) !!}
  19. {!! Form::input('number','exchange_rate', Input::old('exchange_rate'), ['id'=>'ex-rate','class' => 'form-control','readonly','required']) !!}
  20.  
  21. $.ajax({
  22. url: "{{Route('exchange-rate')}}",
  23. type: 'POST',
  24. data: data: {_token: '{!! csrf_token() !!}',currency_id: currency_id },
  25. success: function(data){
  26. $('#ex-rate').val(data);
  27. }
  28. });
  29. });
  30.  
  31. <div id="toke" data-token="{!! csrf_token() !!}"></div>
  32.  
  33. $.ajax({
  34. url: "{{Route('exchange-rate')}}",
  35. type: 'POST',
  36. data: data: {_token: $('#token').data('token'),currency_id: currency_id },
  37. success: function(data){
  38. $('#ex-rate').val(data);
  39. }
  40. });
  41. });
  42.  
  43. <meta name="csrf-token" content="{{ csrf_token() }}">
  44.  
  45. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  46. <script>
  47. $.ajaxSetup({
  48. headers: {
  49. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  50. }
  51. });
  52. </script>
  53.  
  54. data: data: {_token: '{!! csrf_token() !!}',currency_id: currency_id },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement