Jquery mail request does not send to mobile view

I am using the following jquery code

var ajax_url = "tmp/ajax.php";
$(document).on('click', 'input[name="radio_view"]', function () {
    var view_array = {};
    view_array.session_id = $(this).attr('data-session_id');
    view_array.buyer_id = $(this).attr('data-buyer_id');
    view_array.lot_id = $(this).attr('data-lot_id');
    view_array.view = $(this).val();
    $.post(ajax_url, {act: 'save_view', view_array: view_array});
});

      

When fully viewed on PC, it works fine, the request will be sent to tmp / ajax.php, but on the mobile device, the request does not send on the network, it does not display the request.

+3


source to share


2 answers


Since you are using the radio (as I am guessing from the name attribute) to trigger the ajax call, basically 'click' does not work in a browser other than ie. Try going from 'click' to the 'change' event.



$(document).on('change', 'input[name="radio_view"]', function () {
//rest of the code
});

      

+1


source


Try the following:



$(document).ready(function (){

var ajax_url = "tmp/ajax.php";
$(document).on('click', 'input[name="radio_view"]', function () {
var view_array = {};
view_array.session_id = $(this).attr('data-session_id');
view_array.buyer_id = $(this).attr('data-buyer_id');
view_array.lot_id = $(this).attr('data-lot_id');
view_array.view = $(this).val();
$.post(ajax_url, {act: 'save_view', view_array: view_array});

});

      

0


source







All Articles