If you're using a regular XmlHttpRequest (looks like you are), then you're going to be fine. JavaScript and browsers have something called the "Same-Origin Policy", which means, any request to a site which isn't of the same origin is stopped immediately. The only way around this is to use JSON-P, or to use CORS (Cross-Origin Resource Sharing). CORS works by sending specific headers to the server you're trying to talk to, and then the server will typically look over the request, see if the domain is on their whitelist of "Okay" domains, and then give a response.
JSON-P, is actually calling a third party website, but not with an XmlHttpRequest. It's looking at it with the src attribute of the SCRIPT HTML tag. So it's different in the way that it connects to the site (from what I know, I could be wrong though).
If the site that you're working from is dev.myprogram.com you're fine, as the domain is the same.
It doesn't matter what server/engine is processing the request (Apache, nginX, G-WAN, Cherokee, empressa, etc), as it is concerned about the domain it's connecting to, not the service which is handling the connection.
Think of it like a mail man delivering a piece of mail. He needs to have the right address, that's all that matters. If the letter is written in french, it's up to the people at the address to get it to the right person.
With servers, you have different "listeners", which "listen" on different ports. When you have an IP address and a port, you have what is called a socket. The Same-Origin Policy is dependent upon the same socket. So you can't have an Ajax request going to www.example.com:8080/cool_response.php, being requested from www.example.com/ajax_demo.php.
The default http port is 80. So, for the sake of simplicity, browsers don't put that up there, since it's assumed.
What that means is that Apache, or the engine/service which is handling the HTTP connections, is listening to port 80.
The reason I'm going into all of this, is because of the way that Empressa is configured. If you look at your .htaccess file, you'll see something in there called a "handler" and a "type".
AddType application/x-miva-compiled .mvc
Action application/x-miva-compiled /cgi-bin/mivavm
That's saying to apache, "Hey, we're going to handle these specific files in this specific way." So all requests to a .mvc file (even URL rewritten requests, with the file extensions removed) will be handled by the virtual machine (/cgi-bin/mivavm) on the server. This allows empressa and apache walk hand-in-hand into the sunset.
The handling of the .php files will probably be in the httpd.conf file or possibly in the .htaccess. Most likely though, it'll be in the httpd.conf file, since it's usually a universal solution, and shouldn't have to be checked at every connection.
SO, if there was an issue wondering about how .php files and .mvc files can work together, it's a non-issue, since apache is working like a "reverse proxy", passing off the .mvc requests to empressa, and getting the results from there. They listen to the same port, and can therefore sit on the same domain and socket.
And, Miva Merchant deserves a very big "Thank you!!" for that, since it makes our lives (and theirs) much easier.
Also, in case anyone gets adventurous and wants to work with XMPP (Jabber protocol, or a fancy way of instant messaging), you'll find yourself having to do some workaround in order to get everything up to snuff. I think a lot of the typical solutions will result in iframes, as those will give you some more flexibility.



Reply With Quote

