Hell no, what a title :) What i have is a Javascript AJAX request inside an onClick button and i want to pass a variable to the requesting function. This is my javascript AJAX code:
$.request('onRating, { data: {jsAnswer: 55}, success: function() { console.log('Data!'); } })
I now would love to pass the jsAnswer value to this function:
function onRating(){ Db::table('company_profiles_rating')->insert( ['user_id' => 44, 'question_id' => 0, 'answer_value' => jsAnswer] ); }
But this does not work. I also tried to insier tthe jsAnswer inside the brackets of the function but then i get an error. What am i doing wrong?