AJAX Request not working

36 views
Skip to first unread message
Message has been deleted

soonerdm

unread,
Sep 16, 2008, 5:09:02 PM9/16/08
to MooTools Users
Cant get Request to fire off.

What happens onBlur its supposed to send the request to the URL. The
URL is valid but it doenst send the request.

<script>

window.addEvent("domready", function(){
//loop all togglers
$$('.toggler').each(function(el){
el.addEvent('click', function(){
//read the title attribute and turn it into an
object with JSON
var data = JSON.decode(el.get("title"));
//the data.target contains the id you want to
show
$(data.target).setStyle("display", "block");
//el = the element being clicked
el.setStyle("display", "none");
});
});

$$('.tb').each(function(el){
el.addEvent('blur', function(){
var data2 = JSON.decode(el.get("title"));
$(data2.target).setStyle("display", "block");
el.setStyle("display", "none");
valOf = el.get("value");
var url="./index.php?componentName=Video&scid={/literal}
{$scid}{literal}&action=updatecaption"
var vidid = el.get('id');
url=url+"&vidid="+vidid;
// _ui = $('i'+el.id).getProperty('value');
url = url + "&caption="+valOf;
// alert(url);
// url = encode(url);
new Request(url, {method: 'get'}).send();

})
})
});
</script>

kfancy

unread,
Sep 16, 2008, 7:31:30 PM9/16/08
to MooTools Users
Hi soonerdm,

according to moodocs, the url needs to be part of the option list now:
http://docs.mootools.net/Request/Request

try:
var req = new Request({url:url, method: 'get'}).send();

also, I'd experiment with attaching a random number to the GET params
to make sure the browser isn't caching your request.

soonerdm

unread,
Sep 17, 2008, 12:37:56 PM9/17/08
to MooTools Users
Ah... thank you. It was that oversight on my part. Here is the final.
url1 = url + "&caption="+valOf;
// alert(url);
$(data2.target).set('html', valOf);
this.set('html', valOf);
// url = encode(url);
new Request({url : url1 , method: 'get'}).send();


})
})
});
</script>
Reply all
Reply to author
Forward
0 new messages