$( document ).ready(function() {
    var fun = "bja43whspny60x2, knliyajr8y6x0yt, xrhnpx6pfdlquob";
    var app = "bja43whspny60x2, knliyajr8y6x0yt";
    var idList = '';

    $('#formmuseochoix').submit(function() {

        if( $('#facteurs .active input').val() == 'fun'){
            idList = fun;
        }else{
            idList = app;
        }

        var newitem = document.createElement("input");
            newitem.name = "ids";
            newitem.type = "hidden";
            newitem.value = idList;
        $(this).append(newitem);
    });
});
@@ -49,33 +49,32 @@
 bja43whspny60x2,
- 
 knliyajr8y6x0yt,
@@ -73,17 +73,16 @@
 8y6x0yt,
- 
 xrhnpx6p
@@ -122,17 +122,16 @@
 pny60x2,
- 
 knliyajr
@@ -203,20 +203,48 @@
 unction(
+e
 ) %7B%0A
+        e.preventDefault();
 %0A       
@@ -371,25 +371,24 @@
       %7D%0A
-%0A
         
 var newi
@@ -383,193 +383,89 @@
     
-var newitem = document.createElement(%22input%22);%0A            newitem.name = %22ids%22;%0A            newitem.type = %22hidden%22;%0A            newitem.value = idList;%0A        $(this).append(newitem)
+document.location = 'museochoix://loadContexts?ids='+idList;%0A        return false
 ;%0A  

Change submit way