php - javascript function will not fire - cannot determine why -
i trying create search system users can return made search. in order using php sessions recreate search whenever return search page. because function search in javascript, having use ajax post appropriate variables session in php , return javascript variables refire search function.
however, when try use session variables (passed javascript) re fire search function (and present same results again) function not fire, same function fire i.e. original search. have checked , variables same cannot tell why function not fire.
i know it's not problem function original search works no problem. here code. please help.
javascript
var sesssubj = '<?php echo $_session['subject'];?>'; var sesslevel = '<?php echo $_session['level'];?>'; var sesstopic = '<?php echo $_session['topic'];?>'; var sessaddress = '<?php echo $_session['address'];?>'; var sesssort = '<?php echo $_session['sort'];?>'; if (sesslevel != "" && sesssubj != "") { var geocoder = new google.maps.geocoder(); geocoder.geocode({ address: sessaddress }, function (results, status) { if (status == google.maps.geocoderstatus.ok) { center = results[0].geometry.location; searchlocationsnear(center, sesslevel, sesssubj, sesstopic, sesssort); } }); } function searchlocationsnear(center, level, subject, topic, sort) { clearlocations(); if ($('div.pages')) { $('div.pages').remove() } $.ajax({ type: 'get', url: "findlocations.php", async: true, datatype: "json", data: { "level": level, "subject": subject, "topic": topic, "lat": center.lat(), "lng": center.lng(), "radius": 20, "sort": sort }, success: function (data, response) { /* stuff*/ }
Comments
Post a Comment