Ajax in Outlook

U

UKuser

Hi,

I'm trying to get my PHP scripts to email me an email which includes a
button to enable a feature, which I'd like to be done via AJAX so the
user can open the resulting page within their Outlook email rather
than having to open a web browser.

My script is below, however I'm slightly confused, because when run in
Outlook or outside the webserver directory it won't work, but run
inside, it will. Can someone explain what I'm doing wrong? I may have
seen somewhere about accessing XML on another server - is it that AJAX
can't access files from a different URL?

Thanks

A


<html>
<style>#body{font-family:arial,helvetica;}</style>
<script language="javascript" type="text/javascript">
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!

try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var pw = document.getElementById('password').value;
var nm = document.getElementById('name').value;
var cn = document.getElementById('cname').value;
var em = document.getElementById('email').value;
var sc = document.getElementById('source').value;
var queryString = "?password=" + pw + "&name=" + nm + "&cname=" + cn
+ "&email=" + em + "&source=" + sc;
ajaxRequest.open("GET", "http://127.0.0.1/bbb dev/receive.php" +
queryString, true);
ajaxRequest.send(null);
}
</script>

<body>
<span style="font-family:arial,helvetica;font-size:10pt">
<b>Sender</b>:trial<br />
<b>Email</b>:[email protected]<br />
<b>Company Name</b>:trial<br />
<b>Source</b>:trial

<form name='test' method="post" action="http://127.0.0.1/bbb dev/
receive.php">
<input type="hidden" id="password" name="password" value="testpw">
<input type="hidden" id="name" name="name" value="trial">
<input type="hidden" id="cname" name="cname" value="trial">
<input type="hidden" id="email" name="email" value="(e-mail address removed)">
<input type="hidden" id="source" name="source" value="trial">
<input type="button" onclick="ajaxFunction()" value="Submit" />
</form>
<div id="ajaxDiv">Here</div>
</body>
</html>
 
E

Erwin Moller

UKuser said:
Hi,

I'm trying to get my PHP scripts to email me an email which includes a
button to enable a feature, which I'd like to be done via AJAX so the
user can open the resulting page within their Outlook email rather
than having to open a web browser.

My script is below, however I'm slightly confused, because when run in
Outlook or outside the webserver directory it won't work, but run
inside, it will. Can someone explain what I'm doing wrong? I may have
seen somewhere about accessing XML on another server - is it that AJAX
can't access files from a different URL?

Thanks

A

Hi,

The day the my mailreader starts executing Ajax, I switch. ;-)

One thing about Ajax: It cannot make requests to other domains than the one
serving the page that contains your Ajax. As you described yourself above.

In what domain an email in Outlook resides.... I can only guess. Maybe
localhost, maybe something stupid M$-like.

I don't expect you can pull that trick: Ajax in an emailclient.
Only in broken emailclients, so you might give it another shot with Outlook.

So I think you are stuck with opening a browser to get some serious
interaction going.

Regards,
Erwin Moller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top