Jump to content

Recommended Posts

You're probably right anyway, but perhaps I was unclear... the initial ajax request seems to work fine, its the action of the new content that is problematic.

 

I have used this code to call the ajax request:

<form method="post" name="url_submission" id="url_submission" onSubmit="return MyAjaxRequest('credits_used','<?php echo $root;?>includes/credit_calculator.php?url='+url_submission.url.value);" style="width:580px;" action="javascript: MyAjaxRequest('credits_used','<?php echo $root;?>includes/credit_calculator.php?url='+url_submission.url.value);">

and then when it gets there, I have another form to either confirm or reject the submission like this:

<?php 
// start the session 
session_start(); 
header("Cache-control: private"); //IE 6 Fix 
$root='../';
include $root.'includes/db.php';

$q="SELECT `words_per_credit` FROM `customisation` WHERE `id`='1'";
$sql=mysql_query($q);
$r=mysql_fetch_array($sql);
# get the credit to word ratio:
$words_per_credit=$r['words_per_credit'];

#get the URL:
$url=$_GET['url'];

#find whether the url variable begins with www.
$findme   = 'www.';
$pos = strpos($url, $findme);
#if it doesn't begin with www. then make it begin with that:
if ($pos !== false) {
   
} else {
     $url='www.'.$url;
}

#find whether the url variable begins with http://
$findme   = 'http://';
$pos = strpos($url, $findme);
#if it doesn't begin with http:// then make it begin with that:
if ($pos !== false) {
   
} else {
     $url='http://'.$url;
}

///// The next line will download the HTML and put it into a variable called $page
$page = @file_get_contents($url);
#get the number of words in the page:
$word_count=str_word_count(strip_tags($page));

# now calculate the number of credits used
?>
<link href="../netshine.css" rel="stylesheet" type="text/css">
<form onsubmit="horizon.style.visibility='visible'; blanket.style.visibility='visible';" action="<?php echo $root;?>includes/analyse.php" method="post" name="submit_url_form">
<!--<form method="post" name="url_submission" id="url_submission" onSubmit="return MyAjaxRequest('credits_used','<?php echo $root;?>includes/loading_analysis.php?url='+url_submission.url.value);" style="width:580px;" action="javascript: MyAjaxRequest('credits_used','<?php echo $root;?>includes/loading_analysis.php?url='+url_submission.url.value);">-->

  <span class="bottom_links">Analysing: </span><span class="Bold_Text"> <a href="<?php echo $url;?>" target="_blank" class="green_txt"><?php echo $url;?></a></span><br>
  <span class="red_txt">
  <?php $credits=ceil($word_count/$words_per_credit);
echo $credits;?> credit<?php if($credits>1){?>s<?php }?> will be used. Do you wish to continue?</span><br>
<?php if($credits>=6){?>
<span class="small_text">(Please note that this may take some time.)</span> <br>
<?php }?>
<input name="url" type="hidden" id="url" value="<?php echo $url;?>">
<input name="yes" type="image" style="width:38px; height:22px;" onclick="this.src='<?php echo $root;?>images/yes_btn_on.jpg';" onmouseover="this.src='<?php echo $root;?>images/yes_btn_over.jpg';" onmouseout="this.src='<?php echo $root;?>images/yes_btn_off.jpg';" src="<?php echo $root;?>images/yes_btn_off.jpg" alt="Yes"/>
    <a href="<?php echo $root;?>client_area/logged_in.php">
<input name="no" type="image" style="width:38px; height:22px;" onclick="this.src='<?php echo $root;?>images/no_btn_on.jpg';" onmouseover="this.src='<?php echo $root;?>images/no_btn_over.jpg';" onmouseout="this.src='<?php echo $root;?>images/no_btn_off.jpg';" src="<?php echo $root;?>images/no_btn_off.jpg" alt="No"/>
</a>
</form>

It works fine on Chrome but firefox just keeps popping up "loading" followed by the same yes/no form again, Internet explorer just hangs on loading and does nothing else, safari acts like chrome and is perfect.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.