2

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

3 Answers 3

4

Try:

<script>
$('.myvideos').live('click', function() {
    var ide = '123';
    ajax_request(ide);
});

function ajax_request(ide) {
        $('#placeholder').load("test.php?id="+ide);
    }

</script>
Sign up to request clarification or add additional context in comments.

2 Comments

what about the ide var, does it know that is a var or i have to append it using +
sorry didn't see the var ide. Updated. Thanks @Seybsen
4
<script>
  $('.myvideos').live('click', function() {
    var ide = '123';
    ajax_request(ide) 
  });

  function ajax_request(ide) {
    $('#placeholder').load("test.php?id=" + ide);
  }
</script>

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.