www.webdeveloper.com
Results 1 to 2 of 2

Thread: [ASK] Sajax returning value [phpmailelr inside]

  1. #1
    Join Date
    Mar 2012
    Posts
    1

    [ASK] Sajax returning value [phpmailelr inside]

    Hi guys,

    i'm using Sajax call phpmailer, and return error 200 alert popup. I have looked through the forum for a fix for this but I was unable to find one.

    trivia.php
    Code:
    <?PHP 
     require_once("inc/sajax.php");
     include ('inc/connection.php');
    require_once('phpmailer/class.phpmailer.php');
     
    $ans="ans";
    $email="email1";
    function point_trivia($ans){
    sendmail($email);
    return 1;
    }
    
    
    sajax_export("point_trivia");
    sajax_handle_client_request(); 
    
    ?>
    <html>
    
    <head>
    <script type="text/javascript" src="js/sajax.js"></script>
    <script type="text/javascript">
    
    <?php sajax_show_javascript(); ?>
    function action_success(result){
    		
    			//alert(result);
    			if (result=='1')
    			{	
    	
    			}
    			else if (result != '0')
    			{
    				alert (result);
    			}
    
    }
    
    function answer(){
    	var  jawab=getCheckedValue(document.forms['radioExampleForm'].elements['myInput']);
    	var  test="<?PHP echo $ans; ?>";
    	if (answer == test){
    	alert("nice answer");
    	
    	//x_point_trivia(jawab,action_success);
    	}else{
    	alert("wrong password");
    	}
    }
    
    function getCheckedValue(radioObj) {
    
    	if(!radioObj)
    		return "";
    	var radioLength = radioObj.length;
    	if(radioLength == undefined)
    		if(radioObj.checked)
    			return radioObj.value;
    		else
    			return "";
    	for(var i = 0; i < radioLength; i++) {
    		if(radioObj[i].checked) {
    			return radioObj[i].value;
    		}
    	}
    	return "";
    }
    
        
    </script>
    </head>
    <body>
    
    <form name="radioExampleForm" method="get" action="" onsubmit="return false;">
        <input id="test1" name="myInput" type="radio" value="ans"><br>
        <input id="test2" name="myInput" type="radio" value="ans1"><br>
        <input id="test3" name="myInput" type="radio" value="ans2"><br>
        <br>
        <input name="mybutton" type="button" onclick="answer()" value="ok>
    </form>
    </body>
    
    </html
    it always returning popup alert error 200, but the sendmail() function works well...


    I'm sorry again I really need to solve this and i tried to google but I can't find the solution.

    Thank you so much

  2. #2
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    A response code of 200 means the request is successful. So this is not really an issue but how you use that response.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles