Reputation: 27058
i have this example:
<script>
$('.myvideos').live('click', function() {
$('#myvideos').trigger('click');
var ide = '123';
function ajax_request() {
$('#placeholder').load("test.php?id=ide");
}
});
</script>
how can i trigger the ajax_request
function after $('#myvideos').trigger('click');
happens and pass the ide
var to load link?
any ideas? thanks
Upvotes: 2
Views: 1682
Reputation: 6740
Try:
<script>
$('.myvideos').live('click', function() {
var ide = '123';
ajax_request(ide);
});
function ajax_request(ide) {
$('#placeholder').load("test.php?id="+ide);
}
</script>
Upvotes: 4
Reputation: 4281
You don't really have to put the AJAX call inside a function
<script>
$('.myvideos').live('click', function() {
$('#myvideos').trigger('click');
var ide = '123';
$('#placeholder').load("test.php?id=" + ide);
});
</script>
Upvotes: 0
Reputation: 8726
<script>
$('.myvideos').live('click', function() {
var ide = '123';
ajax_request(ide)
});
function ajax_request(ide) {
$('#placeholder').load("test.php?id=" + ide);
}
</script>
Upvotes: 4