Jump to content

Not printing out


HDFilmMaker2112

Recommended Posts

For some reason the AJAX output on this page is not working.

 

<script type="text/javascript">
function requestObj() {
    var reqObj;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        reqObj = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        reqObj = new XMLHttpRequest();
    }
    return reqObj;
}

var http = requestObj();

function sndReq(action,id) {
    http.open('get', 'second_credit.php?credit='+action+'&id='+id, true);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById("ajaxout").innerHTML = response;
    }
}

</script>

 

$content.='
<form action="" method="post">
    <p><label>Name Credit is Listed Under:</label> <input type="text" name="name" size="30" /></p>
    <p><label>E-Mail of Original Purchase:</label> <input type="text" name="email" size="32" /></p>
    <p><label>Original Credit Purchased:</label>';
    $sql_credit="SELECT $tbl_name2.credit,$tbl_name.donor_id,$tbl_name2.film_number FROM $tbl_name JOIN $tbl_name2 USING (donor_id) WHERE $tbl_name.username='$myusername' AND $tbl_name.password='$mypassword'";
    $result_credit=mysql_query($sql_credit) or die(mysql_error());  
    $menu_generate="";
    
    while($credit_rows=mysql_fetch_array($result_credit)){
extract($credit_rows);
$menu_generate.='<option value="'.$credit.'-'.$film_number.'" >'.ucwords($credit).' - Film # '.$film_number.'</option>'."\n";
    }

$id=$_GET['donor_id'];

$content.="<select name=\"credit\" onchange=\"sndReq(this.value,$id);\">";
$content.='<option value="">Select Credit</option>'."\n";
$content.=$menu_generate;
$content.="</select>";
$content.='<p><label>Second Credit to Purchase:</label>
<span id="ajaxout"></span></p>';
$content.='<p><input type="submit" value="Submit" name="Submit" /></p>
    </form>
';

 

When I check the page called by ajax (second_credit.php), it loads properly. So the issue with the ajax call or the display.

Link to comment
Share on other sites

I'm talking about your second_credit.php page. From the code that you have there, you aren't actually outputting anything on that page, so your response text will not return anything.

 

?

 

I didn't even include my second_credit.php page.

 

That's here:

 

<?php
session_start();
$myusername=$_SESSION['myusername2'];
$mypassword=$_SESSION['mypassword2'];

require_once 'db_select.php';
$credit=$_GET['credit'];
$credit=explode('-',$credit);
$credit=$credit[0];
$id=$_GET['id'];

$sql_films="SELECT $tbl_name4.position,$tbl_name4.film_number FROM $tbl_name4 LEFT JOIN $tbl_name2 ON $tbl_name4.item_id=$tbl_name2.item_id LEFT JOIN $tbl_name ON $tbl_name.donor_id=$tbl_name2.donor_id AND $tbl_name.donor_id='$id' WHERE $tbl_name4.position='$credit' AND $tbl_name2.item_id IS NULL";
$result_films=mysql_query($sql_films) or die(mysql_error());  
  
  $select.='<select name="new_credit">'."\n";
  $select.='<option value="">Select Credit</option>'."\n";                
  while($row_films=mysql_fetch_array($result_films)){
  extract($row_films);
       $select.='<option value="'.$position.'-'.$film_number.'" >'.ucwords($position).' - Film # '.$film_number.'</option>'."\n";
  }
$select.='</select> ';

echo $select;
?>

 

The page I posted in my first post is credit.php which contains the HTML where the AJAX is supposed to print out. I didn't include second_credit.php because I didn't think it was really relative to the situation.

 

As you can see here:

http://www.makethemoviehappen.com/second_credit.php?credit=gaffer&id=2

 

second_credit.php works fine.

Link to comment
Share on other sites

would have been nice to know that the first php code that you posted was from index.php, you never specified that.

Have you debugged your AJAX with alerts to try and find an error in the AJAX code?

the second_credit.php will of course be important here, its where you are sending your information via AJAX!

Link to comment
Share on other sites

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.