1

It seems that the Drupal Ajax API are comming a little un handy for my current project so i was trying to do the ajax request the good old way with actual Javascript.

I have this code

valdBut.click(function(event){
    event.preventDefault();

            jQuery.ajax({
            type: "POST",
            dataType: 'json',
            data: grabValue(),
            url: urkl,
            success: function () {

                alert(back)

            }
        });
    alert(grabValue())

})

What i am wondering is how should i link that URL value to my module page, so that my user_login hook receive the data sent via Ajax ?

Thanks for any help, Manu

2 Answers 2

2

For most functionality that you require with drupal, there is typically a module that already does what you are after or close to it.

I would recommend either:

Hope this helps

3
  • Thanks for you answer, unfortunately it's not really help full in my case.
    – silkAdmin
    Commented Jun 25, 2011 at 9:13
  • Then may I suggest you clarify your question? I read it like you are after a solution to allow users to login via AJAX on your site, is this not the case?
    – wiifm
    Commented Jun 25, 2011 at 10:50
  • Yes it is but i am using Drupal 7 and the module you suggested is Drupal 6 only. It s ok i got it figured out. See answer below.
    – silkAdmin
    Commented Jun 27, 2011 at 13:04
0

This tutorial (tough Drupal 6) helped me a lot http://viziontech.co.il/tutorial1?1309179897 .

The big piece that i was missing is that i needed a Hook_menu that countain my php script that will handle the ajax request, then in the ajax path i add the newly created link (from the Hook_menu).

Also the JS needed to be added to that specific module with a drupal_add_js for the ajax call back to be received. It took me a while to figure out but if i add the script via Theme.info file it behaves very oddly..

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.