SEOClerks

Fix javascript user id not being sent

Fix javascript user id not being sent

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

Php Js Javascript Laravel

Bids

**** quitely easy job ****

i can fix it with in 2 hours,
please ping me

i can do this easily.

Bid On Listing Created 7 years ago in Programming

Other jobs by mikeboy