using ?id= with $.ajax
using ?id= with $.ajax
I am trying to convert my site http://ultimate-battle-online.com into
a web App and so far I have:
<script type="text/javascript">
$(document).ready(function(){
$('#main_content').load('cityhall.php');
$('#loading').hide();
$('a').click(function() {
$("#main_content").slideUp();
var replacement = $(this).attr("title");
var content_show = $(this).attr("id");
$.ajax({
method: "get", url: replacement, data: content_show,
beforeSend: function(){$("#loading").show("fast");},
complete: function(){$("#loading").hide("fast");},
success: function(html){ //so, if data is retrieved, store it in
html
$("#main_content").slideDown("slow"); //animation
$("#main_content").html(html); //show the html inside .content
div
}
});
//Take contents of mini side and update info
on side panel
$.ajax({
method: "get", url: 'includes/side_mini.inc.php',
success: function(html){$("#side_details").html(html);}
});
//Take contents of mini side 2 and update info
on side panel
$.ajax({
method: "get", url: 'includes/side_mini2.inc.php',
success: function(html){$("#activity").html(html);}
});
});
});
</script>
For some reason it likes the regular links with out a get data which I
put in "id=123" form. How would I get it to basically do what
stats.php?id=1 would do in a regular PHP file? Also leaving the url as
"stats.php?id=1" does not load lol... figures... Any ideas?