NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page AJAX/Javascript help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-25-2006, 11:36 PM THREAD STARTER               #1 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,272
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis

AJAX/Javascript help


Hey,

I am trying to get this thing to work. But it doesn't.. Anyways enough n00bie stuff.. So.. Basically it used XMLHttpRequest to 'get' / 'post' a rate image id and a rating to rate.php. In the format of rate.php?r=votevalue&i=rateimageid.. I have the html side all done and I know it works.

Basically just
<a href="javascript:sendReq(1,rateimageidgoestherewit hphp)" id="rating_1">Stuff</a>
????: NamePros.com http://www.namepros.com/programming/231612-ajax-javascript-help.html
...
...
... etc for 5 of them.. Each using the CSS rate image thingy.

The AJAX/Javascript code is this
Code:
function sendReq(vote,id_num) {
    
    /* Set up the request */
    var xmlhttp =  new XMLHttpRequest();
    xmlhttp.open('get', 'rate.php?r='+vote+'&i='+id_num);
    
    /* The callback function */
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200)
                addRatingFeedback(xmlhttp.responseXML, target);
    }
}
xmlhttp.send(null);
}

function addRatingFeedback(responseXML, target) {
  var width = responseXML.getElementsByTagName('rating')[0].firstChild.data;
  document.getElementById('current_rating')style.width = width;
  document.getElementById('rating_1')href = '';
  document.getElementById('rating_2')href = '';
  document.getElementById('rating_3')href = '';
  document.getElementById('rating_4')href = '';
  document.getElementById('rating_5')href = '';
}
Myself not being that great at the old javascript just did what I know.

But for some reason.. When you click on it.. It is just not working.. The rate.php works because I tested that.. It is just this AJAX part..

Any help will be apprecited.

- Steve
__________________
I feel old.
iNod is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:36 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger