Closed

Fix javascript user id not being sent

Posted Aug 21, 2017 3 bids 1,772 views Job #53928

Job details

The brief
I need someone who is good with javascript and Laravel to fix a gift plugin it does not send the userid on submission

This is the data that is being submitted

data={to_user: $('#userid_gift').val(),gift_id:gift_id,msg:msg};

this is from the console view

to_user=&gift_id=11&msg=

the gift id is there but the to_user is empty so it fails

Requirements

This is the Javascript code that is used in the forms

<script type="text/javascript">
if( @if(request()->is('profile/*')) true @else false @endif ){
$('#gift-modal').show();
}
$('.giftimage').on('click',function(){
$('.giftimage').removeClass('activegift');
$(this).addClass('activegift');
})
$('#send_gift').on('click',function(){
var gift = $(this).parent().parent().find('.giftimage.activegift');
var gift_price =gift.data('price');
var gift_id =gift.data('giftid');
var msg='';
data={to_user: $('#userid_gift').val(),gift_id:gift_id,msg:msg};
$.ajax({
type: "POST",
url: "{{{ url('/send_gift') }}}",
data: data,
success: function(data){

toastr.success(data.message);

window.location.reload();

},
error: function(XMLHttpRequest, textStatus, errorThrown) {
toastr.error("{{{trans_choice('app.error',1)}}}");
}
});
})
</script>

This is on a seperate php file

<script>
$('#giftmodal').on('click',function(){

$('#userid_gift').val('<?php echo e($user_id); ?>');

$('#userid_gift').val('{{{$user_id}}}');

$('.gift_header').text("{{{trans('app.send_gift')}}}");
})
</script>

I need the to_user to get populated with the correct info i.e.

to_user=523&gift_id=11&msg=

523 being the user the gift is getting sent too

Skills required

Attachments

Bids (3)

Average bid $25
Proposals stay private. Only the buyer and each bidder can see that bid's price and message.
AlienVirus AlienVirus Level 1 · Aug 21, 2017
Well above average Over budget

Private proposal submitted

misterbell4020 misterbell4020 Level 1 · Aug 21, 2017
Below average

Private proposal submitted

ask2talk ask2talk Level 1 · Aug 22, 2017
Below average Over budget

Private proposal submitted

Questions

Public, answered by the buyer
Budget Up to $10 / project
  • Delivery1 day
  • Seller level neededAny
  • Bids3
  • Average bid$25

About the buyer

mikeboy
mikeboy
Level 1 · Offline ·
  • Orders placed13
  • Ratings0
  • Response15 hours
  • JoinedJan 21 2013