Answer the question
In order to leave comments, you need to log in
Why is the jquery script not executing?
Friends, when loading the site, I load the php file via Ajax in which the tpl file is loaded
<script async>document.addEventListener("DOMContentLoaded", function(event) { $.ajax({ url:'/ajax/cities.php', success: function(mes){ $('.footer1512-container').before(mes);}});});</script>
<?
session_start();
require_once('../api/Simpla.php');
$simpla = new Simpla();
$all_cities = $simpla->cities->all_cities();
if( isset($_SERVER['HTTPS'] ) ) {
$simpla->design->assign('protocol', 'https://'); }
else { $simpla->design->assign('protocol', 'http://');}
$text = $_SERVER['HTTP_REFERER'];
$array = explode("/",$text); // перерабатываем строку в массив
$array = array_slice($array,3); // выбираем первые 5 слов-элементов
$array = implode("/",$array);
$domen=explode('.',$_SERVER['SERVER_NAME']);
if(sizeof($domen)>2) {$domen=substr($_SERVER['SERVER_NAME'],strpos($_SERVER['SERVER_NAME'],'.')); preg_match("/[^\.\/]+\.[^\.\/]+$/", $domen, $matches); $domen = ".".$matches[sizeof($matches)-1];} else $domen = ".".$_SERVER['SERVER_NAME'];
$simpla->design->assign('domen', $domen);
$simpla->design->assign('script', $array);
$simpla->design->assign('all_cities', $all_cities);
$result = $simpla->design->fetch('setcity.tpl');
header("Content-type: application/json; charset=UTF-8");
header("Content-Encoding: gzip");
header("Cache-Control: must-revalidate");
header("Pragma: cache");
header("Expires: -1");
print gzencode(json_encode($result), 9);
$().ready(function() {
$('.city_frame').jqm({trigger: '.city_btn'}).addClass('show');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question