/    Sign up×
Community /Pin to ProfileBookmark

[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
[/CODE]

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

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@holyhttpMay 01.2012 — A response code of 200 means the request is successful. So this is not really an issue but how you use that response.
×

Success!

Help @zongvoc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...