function cliptext(text){ var dummy = $('').val(text).appendTo('body').select() document.execCommand('copy') }; $("body").on("click", "button", function(){ if (this.id=='button') choix_produit($(this).val()); else if (this.id=='button_fou') choix_fournisseur($(this).val()); else if (this.id=='cliptext'){ //alert($(this).val()); cliptext($(this).val()); } }); $("#fournisseur_display").hide(); function choix_produit(id){ $("#choix_projet").hide(); $("#fournisseur_display").show(); $("#produit_affiche").show(); $.ajax({ url: 'index.php/Projets/choix_produit/'+id , type: 'get', dataType: 'json', success: function(responseData){ // console.log(responseData.des_ref_type); $("#produit_affiche").html(responseData.details_produit); // $('#pagination_fournisseur').html(responseData.choix_fournisseurs.pagination_produits); $('#Produits_actif').empty(); $('#Produits_actif').html(responseData.recordCount); mem_select=responseData.des_ref_type; mem_choix_produit_id=responseData.des_id; if (responseData.gen_actif_fournisseur==1){ createpagination_fournisseurs(0); }else{ ; choix_fournisseur(0); } } }); } function choix_fournisseur(id){ $("#choix_projet").hide(); $("#fournisseur_display").show(); // alert('proj_ent_id'+); $("#produit_affiche").show(); $.ajax({ url: 'index.php/Projets/create_proj_details//'+mem_choix_produit_id+'/'+id , type: 'get', dataType: 'json', success: function(responseData){ console.log(responseData); lien='https://'+window.location.hostname+'/index.php/projets/form//null/new/'+responseData; //alert(lien); window.open( lien,"_self"); //alert(lien); //location.reload(true); } }); console.log('ok fin'); mem_choix_produit_id=0 $("#choix_projet").show(); } if (''=='new'){ $( "#mod_btn_0" ).trigger( "click" ); $('#det_desc').focus(); }