Ajax Path not working, can't find the cause - javascript

I have a simple Ajax function that changes a div.
The following code works, but it loads the index.php in my div also, which I don't want.
xmlhttp.open("GET","index.php?p=productDesc&q="+currentID,true);
Although the above works I'm trying to take the productDesc.php only, and it does not work.
xmlhttp.open("GET","pages/productDesc&q="+currentID,true);
Any ideas what might be causing that?
I searched but according to what I found I don't have anything wrong.
Any help appreciated.

Related

Using Javascript to sort table properly?

I've been working on this website on my computer for the past several weeks, but have had it a point that I just can't figure something out with my table sorting. The site itself runs off PHP but I've duplicated the HTML output to make it easier for you guys to help me diagnose what the problem is.
Here's a link to the Working Page: http://privateservercloud.com/working.htm
Here's a link to the Not Working Page: http://privateservercloud.com/not-working.htm
If you go to the Working Page, you'll see that you can click on any of the headers of the table and it will sort them. However, if you go to the Not Working Page, you'll see that this doesn't happen.
I'm trying to figure out what's missing or coded incorrectly and causing this to happen. I've uploaded all of the HTML, CSS, and Javascript that's running this part of the site so you can see how it's all working and hopefully that'll make life a bit easier for anyone that can help.
So... does anyone see what I'm doing wrong or know what needs to be fixed?
I load the not-working example in Firefox with Firebug and get the following:
TypeError: document.getElementById(...) is null
...for(var e=0;e<menuids.length;e++){var t=document.getElementById(menuids[e]).getE...
in dropdown.js line 1.
The debugging tools really are your friends. If you don't want to use Firefox, you can do the same thing with the development tools in Chrome.
I find errors when I run rhe validator at http://validator.w3.org and a pile of CSS errors at http://jigsaw.w3.org/css-validator/
When things don't work right, validate the HTML, which at least mostly assures you have a valid DOM. Then validate the CSS and use the JavaScript console in your favorite browser's debugger.

Jquery Select2.js Does Not Work After Migration

I migrated my form from a file to another with different file location. I also have changed all reference paths on that new file. Unfortunately, the select2() function doesn't work anymore in
$("#field1, #field2, #field3").select2();
To make sure if the path is right, I have tried to put
alert('hello from select2.js');
And the alert function works when I open the form. And it makes me confused why the .select2() function does not work.
Did I miss something? Please help and thanks for advance.
Finally found it. After two days. I refered to jquery.js twice. And I don't know why, it really caused the error. After I dismiss one of them, my problem solved. Thanks for everyone who tried to help me :)

Why can't I mimic page in jsFiddle?

I am viewing the source of http://raphaeljs.com/growing-pie.html . And copying all the relevant stuff into this jsFiddle. But the page is not working at all. I don't get any errors in the fiddle either, except this odd warning: Detected baseUrl as https://towtruck.mozillalabs.com . Anyway, i cant find any differences between the two pages and cant figure out why the fiddle isn't working. Thanks for your help!!! <:)>
The difference is that you need to include the Raphael library. Just selected it in the sidebar and pulled your code out of the onload handler in the JSFiddle in my comment.

Why might toggles not work?

This page has toggles, in the "Why We're So Good" section. They suddenly stopped working. I don't know what might of changed since then. This is how they'd work, normally.
Could someone please explain how the toggles work in general, and why they aren't working now?
(Also, is there any way to find out what JavaScript is changing the document?)
EDIT: prettyPhoto is an a completely unrelated script that does lightbox stuff
You are missing the http://wowballoons.com/wb/wp-content/themes/nevada/nevada/javascripts/jquery.prettyPhoto.js?ver=1.3 file in your application, that is why it is not working.
Please download the prettyPhoto script file and add it to your page.
You have a script error on the html page:
$("a[data-rel^='prettyPhoto']").prettyPhoto({
TypeError: $(...).prettyPhoto is not a function

How Scale text to parent div plugin problems

I've been trying to make this script work for an hour with zero luck.
Heres the proper jsfiddle: http://jsfiddle.net/zachleat/WzN6d/
Here's my website where the broke code is:
http://designobvio.us/dov2/index.html
I'm totally novice with javascript/jQuery. Please forgive me if this is a retarded semantics problem.
thank you
Looks like you are missing the document.ready try adding the following.
$(function(){
$('#bigtext').bigtext();
});
jsfiddle does this for you automatically, thats why you don't need it there.

Categories