J'ai créé un script AJAX pour le composant RSForm Joomla qui permet de calculé un tarif grâce à l'API Google distancematrix.
Ce module fonctionne bien sur la plupart des navigateurs, sauf sur Internet explorer et safari iOS8.
Voici l'adresse du module http://www.navette-discount.fr/fr/#devis-reservation
Et voici la partie du script qui semble ne pas fonctionner sur ces navigateurs. Quelle est selon vous la solution alternative?
Doit on repasser par l'utilisation de l'objet XHR?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 <script> jQuery(document).ready(function(){ // we wait until DOM is ready jQuery('#search').click(function(){ // we bind a function when clicking the button we added earlier //traitement des variables. jQuery.ajax({ // we build the AJAX request type:"POST", url:"index.php?option=com_rsform&formId=11&action=ajax", // Due to Cross Origin Request Blocks we need to call it sever side (this is the reason why we created the PHP script called on form display ) please make sure you use the correct formId (the ID of this form) data: {origin, destination}, // we send the origin and destination information to the script we already crated success: function(results) { //traitement et affichage du résultat //Display results jQuery("#resultat").html('<p class="alert alert-info center lead"><strong>Distance : '+km+' Km</strong><br/><strong>Tarif : '+estimation+'</strong></p>'); } } }); }); }) </script>
Merci d'avance
Partager