Pass id to page without sessions

2

I'm doing a sales module and with a button I go to the list of clients. When you click on a row of the table I want in the AJAX request to call l index and pass the client as a parameter to consult it in the ready. Because I do not want to use sessions because it's not a sales cart, it's a spontaneous sale in a store.

$('#clientes tbody').on('click','tr', function(evt){
    
       $(this).find('input:radio').prop('checked', true);
 var idc= $('input:radio[name=seleccion]:checked').attr("id");
alert(idc);
    var accion = 'asociar';
    $.ajax({
	  
            type: "POST",
  
            data: {"idc":idc,"accion":accion}, 
            

            error: function(){
                alert("error petición ajax");
            },
           success: function(data){
          
            window.location.href ="index.php?controller=venta&action=index?id=".idc;
           }
           
        });
}); });                    
asked by Caruso 13.11.2018 в 14:04
source

1 answer

0

The problem I see is how you build the URL, before you should put an &, also the concatenation in JavaScript should be done with a +, that is, it should be like this:

$('#clientes tbody').on('click','tr', function(evt){

       $(this).find('input:radio').prop('checked', true);
 var idc= $('input:radio[name=seleccion]:checked').attr("id");
alert(idc);
    var accion = 'asociar';
    $.ajax({

            type: "POST",

            data: {"idc":idc,"accion":accion}, 


            error: function(){
                alert("error petición ajax");
            },
           success: function(data){

            window.location.href ="index.php?controller=venta&action=index&id=" + idc;
           }

        });
}); });
                                    
answered by 13.11.2018 / 14:34
source