Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

Ajax in Outlook


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?



<script language="javascript" type="text/javascript">
function ajaxFunction(){
        var ajaxRequest;  // The variable that makes Ajax possible!

                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                                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", "" +
queryString, true);



<span style="font-family:arial,helvetica;font-size:10pt">
<b>Sender</b>:trial<br />
<b>Email</b>:t@trial.com<br />
<b>Company Name</b>:trial<br />

<form name='test' method="post" action="
<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="t@trial.com">
<input type="hidden" id="source" name="source" value="trial">
<input type="button" onclick="ajaxFunction()" value="Submit" />
<div id="ajaxDiv">Here</div>


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.

Erwin Moller

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc