AJAX works online but not on my computer - ajax

I've been having problems testing AJAX on my computer, the code works fine online but not on my system, is there something I am missing?
I've had this problem with pretty much any kind of AJAX and even some javascript code. I know the code itself is correctly since it's functioning online as intended, but why wouldn't run on my PC? Everything I am trying to do is basic coding, no database, or advanced functions of any kind, simple interface changes and such.
I don't have any specific code to post since its a general problem i'm having, but any thoughts are appreciated. Could it be a document type issue? I tried blank and a couple of others but none seemed to matter.

Ill bet that you are having a same origin policy issue. If you are loading the page by going to localhost:<port>/app and then your javascript tries to go to anywhere other than localhost the browser will stop it for violating the policy.

I have had strange problems testing AJAX locally before. To fix this I install ultidev's Cassini web server and run the application on that and it seems to work.

You need to set up a webserver with either php running or something like it. A desktop PC is not a web server by default.

Related

Dagre-D3 or D3 not working on different server

Hy, so unfortunately i cant post my hole source code, neither can i link to it.
But because of this, I'm ok if i don't get a concrete answer, just some guidance.
So my situation is this:
I have made, with the help of dagre-d3.js and d3.js a hierarchy organizational chart. It works perfectly on local (WAMP) environment, but when i try it on the live server, which runs linux (ubuntu), not all the functions are working correctly.
But what i don't understand is that the functions that are not working 100% percent are just front-end svg stuff, so there is no back-end connection when i try these operations.
Locally i tested it with windows 7, 8 on wamp and in chrome, firefox, even internet explorer, and every functionality works, when i load it from the server, some functionalities are not working. And the fact is that i don't get any error messages, so its not like d3.js or dagre-d3.js isnt correctly loadded, because it is, the graph is rendered correctly.
So to finish up, my question is this, can there be some server side configuration which interferes with the rendered SVG graph? And if no, then where should i start looking? How to even check wheres the problem?
Thank you in advance for any kind of guidance.
Ok, so at last i figured it out.
On the live server there was a different version of php which, when using json_encode converted the ids to strings, and because of this the dagre-d3 plugin didn't work as it should have, some functionalities did, but not all.

Debugging AngularJS web app in Firefox extensions

I have created a Firefox extension that loads an iframe. That iframe loads a web application built using AngularJS. Is there anyway to inspect what is going on? The application loads but I have 2 input boxes that I am unable to type in.
I've developed the extension in both XUL and using the Add-On SDK and both of them don't allow me to interact with the input box. I've further noticed that when I remove the ng-model attributes, interaction works. It seems like data binding is an issue.
Any ideas?
Thanks
Without seeing the code, it's hard to say what's going wrong. If I were running into this problem (and I've run into similar ones), I generally fall back to editing the Angular source, and adding dump (or console.log) statements to try and trace what's going on. It's pretty terrible, but it usually gets the job done.
Good luck!
This question is kinda old by now, but as a reference for people coming here from a web search:
you might want to look at this SO question that lists some things that can go wrong with AngularJS inside XUL extensions, together with some solutions.

Intemittent Cannot create ActiveX component

Everything was working fine, and then our code starts throwing:
Cannot create ActiveX component when we try to create a com object.
We reboot the server a couple of times and it goes away
Then after a while it comes back
This is driving us nuts. Any help appreciated.
I apologize that the question was vague. However we had no clue what was causing the problem so what facts would have been relevant?
At any rate it turns out we have two web apps running under IIS, both are trying to create ActiveX components. As soon as we turn one of the web apps off the problem goes away.
After we verified this behavior, we tried calling some simple ActiveX components (like excel). Lo and behold exactly the same behavior as long as there are more than two web apps running.
Our solution for now is to host the second web app elsewhere.

"dojo is not defined" - Firefox 3.5 issue?

Please take a look at this code:
http://3wcloud-com-provisioning-qa.appspot.com/testAjaxDojo
Just tab off the "domain" input field to try to make the Ajax run.
(Note: the test Ajax web service always sends back the same message, it pretends to check if domain is available but it really doesn't).
When running in Firefox 3.5, I get "dojo not defined" on the dojo.xhrGet statement.
It works fine in IE7 and Chrome browsers, and one friend tested on Firefox 3.0 and it worked.
1) Is there something wrong with Firefox 3.5 not properly getting the dojo javascript from the CDN? Possibly a caching issue?
2) Do you Dojo gurus know of this problem? Is it something that has already been reported to Firefox?
Thanks,
Neal Walters
Update: 9/1/ afternoon - I have uninstalled and re-installed Firefox 3.5.2 (but I kept my profile settings), and got same problem. I'm on Windows Vista Ultimate.
Finally found the problem. It was the add-on called "No-Script". Even though I had set No-Script to allow scripts globally, something in that tool was causing the issue. I upgraded to new version of No-Script and still had problem. If I disable the add-on (from the Tools/Add-ons screen), then Dojo loads perfectly from the CDN and life is good again.
I probably lost 6-8 hours on this stupid issue. Hope this posts saves someone else the time. Please "vote-up" the answer if it does.
As I stated in my comment, on Firefox 3.5 (mac) works fine. Try to do the following on your Firefox browser, insert the dojo library url in the url bar:
http://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js
Usually it helps to solve any cache problems and forces Firefox to fetch the file.
If it still doesn't work, just store dojo in your server and use it locally.
It's working fine here with NoScript enabled.
I just needed to allow both "3wcloud-com-provisioning-qa.appspot.com" and "ajax.googleapis.com".

How can I check my AJAX for browser capable?

I always have to check each and every browser to see if my website would work. Is there a website where I can check it with?
Update:
I don't really want just screenshots (which what browsershots do), I want to actually test the posting of my script.
You want a web site to check your web site for javascript compatibility? How would you expect it to know how to exercise your interface to trigger the proper interactions? Or are you thinking of it doing some sort of static code analysis? I think you are better off coding against a framework that has solved most of the browser-dependent idiosyncrasies and using it to check for browser capabilities before you use them. jQuery, MooTools, Prototype/Scriptaculous, etc. go a long way in solving these problems for javascript.
Note that you still need to worry about rendering your site, but you already have several answers for how to go about doing that based on web sites. Personally, I just maintain IE/Safari/FF/Opera/Chrome on my workstation and do significant checking in IE/FF and basic checking in Safari/Opera/Chrome.
Even when there exist websites that allow you to see a static snapshot of your site in several browsers, you should really test your page on them yourself, because there can be subtle, and not so subtle, bugs and differences that are only apparent when interacting with the webpage.
You can cover yourself quite a lot by testing in
A Gecko engine browser (Firefox)
A Webkit engine browser (Chrome, Safari, Konqueror)
Opera
AND IE6+
John Resig recommends checking the Yahoo graded browser support documentation.
If you write unit tests for your javascript, you could use testswarm http://testswarm.com
There are multiple options:
http://ipinfo.info/netrenderer/
These site will let you run multiple browsers and version without installing. You only need to install a plugin
http://spoon.net/browsers/
There are plenty of sites, just Google/Bing for browser compatibility check.
http://browsershots.org/ is a good one.
Although most of them just take a snapshot of the site, you might have to do the manual check for things like menus and dynamic content.
BrowserShots might do what you want if you can tell by rendering a particular URL whether or not things will work as expected.
In light of your update, you could still use BrowserShots by creating a page which tests each of your scripts and renders 'pass' or 'fail' as its content depending on whether they work or not.
Failing that, Multiple IE is quite useful for running various versions of IE on one PC which can otherwise be problematic.

Resources