Jump to content
MakeWebGames

No Loading


DangerBoy
 Share

Recommended Posts

I am not gonna register there, so I only speak in general.

yourjail.php should echo the message in html that you want to show

$('#bust').click(function(){
 $('#bustMsg').load("yourjail.php?bust=bustid");
})

 

 

<button id="bust">Bust from jail</button>
<div id="bustMsg"></div>
Link to comment
Share on other sites

Their code is:

<script type="text/javascript">

$(document).ready(function(){

$(".bust").live('click', function() {

$(this).html('Loading...');

$.ajax({

type: "POST",

url: "../php/prison.php",

data: "bust=" + $(this).attr('id'),

success: function(response){

$('#content').html(response);

$('#refresh').load("prisonfeed.php");

}

});}); });

</script>

But I don't understand it. Sorry, im new to javascript

Link to comment
Share on other sites

Have the link or button, or what else, the user clicks to bust out, have class named bust

 

<a class="bust" id="#THENUMBERYOUUSUALLYPLACEINTHEBUSTURLDONTMEANTOYELLJUSTHIGHLIGHTING#" href="#">Bust</a>
<div id="content">the busting result will be here</div>
<div id="refresh">
this is probalby where the list of inmates is shown
</div>

 

I assume you have a jail and jailbusting script already, that may be soemthing like jail.php?bust=1234

url: "../php/prison.php",

^ change that to match the location of that script, have script look for $_POST['bust'] (remember to validate), and then do the busting, echo the result, and die; Whatever is echoed here should show up in the content div.

Same principle with prisonfeed.php

Link to comment
Share on other sites

You might learn more by writing it again. But I would not really call it copyright infringement to use the snippet.

Perhaps use

type: "GET",

As according to guy expert on interfaces, POST causes two http calls to be made, and should be avoided unless sending much data.

If you do that, make sure that the php backend script dont already use $_GET['bust'], if it does use $_GET['bust']

Change

data: "bust=" + $(this).attr('id'), to data: "bustid=" + $(this).attr('id'),

and look for $_GET['bustid'] in the php script. or something

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...