I have looked over my code and realized there where a few issues with the script. Now I have sorted it it will not pass through the checking you have the correct funds. i think it has something to do with the way i have declared my variable
<script type="text/javascript">
var money = "<?php echo $ir['money']; ?>";
var price = 5000;
function openAccount() {
var c = confirm("Are you sure you want to open a bank account for <?=money_formatter(price)?>?");
if(c) {
$('#main_text').html('Opening account');
$('#main_text').append('Checking you have the correct funds');
if(+money < +price) {
$('#main_text').append('<span style="color: red;">Incorrect funds, You need another <?=money_formatter((price)-$ir["money"])?>...</span>');
} else {
$.post('<?=file?>?open=true&print=1', function(data) {
if(data == 'not_enough_money') {
$('#main_text').append('Incorrect funds...');
} else if(data == 'opened') {
$('#main_text').append('You have succesfully opened your brand new bank account!<a href="javascript:void(0);">>View Account</a>');
}
});
}
}
}
You simply forgot two quotes.
Replace <a href="javascript:void(0); onClick=new_account();">
by <a href="javascript:void(0);" onClick="new_account();">
and everything will work.