I have 2 ajax requests on one page. Both work fine on separate pages, but when they are on the same page, one stops working after the first start.
I use the Colorbox plugin for a single request, and this works great. The other one I built myself (I'm new to jquery, so it may have errors) and works if I run it first. But as soon as Colorbox is activated, it stops working.
The page is here: http://dev.thetram.net/times/test2.php and the code below.
It would be very helpful to understand where I am going, thanks!
<script type="text/javascript">
<!--
$(document).ready(function(){
$(function() {
$('#parkride').change(function () {
$.ajax({
type: "POST",
url: "http://dev.thetram.net/inc/parkingfinder_script.asp",
dataType: "application/x-www-form-urlencoded",
data: "Action=GetPR&Val=" + $("#parkride").val(),
async: false,
success: function(msg) {
$('#output').html("<li>" + msg + "</li>");
}
});
return false;
});
});
$(function() {
$('form#frm_journeyplanner #submit').click(function () {
var str = $("form#frm_journeyplanner").serialize();
$.ajax({
type: "POST",
url: "http://dev.thetram.net/inc/journeyplanner/jp_testscript.asp",
dataType: "application/x-www-form-urlencoded",
data: str,
async: false,
success: function(msg) {
$('#results').html(msg);
$.colorbox({inline:true, href:"#results", opacity:0.6, innerWidth:620, innerHeight:580, title:"Find tram times",
onOpen:function(){ $("#results").show(); },
onClosed:function(){ $("#results").hide(); }
});
}
});
return false;
});
});
});
-->
</script>
source
share