By tomas.teicher on
hi,
I have ajax script which call my own php script. In this script I want to use drupal standard functions. I want to avoid to use including for each php file I use. Is any standard way, how to use drupal functions (as t(), l() etc) in my php file called with ajax?
thanks for advise
Tomas
Comments
go through this
go through this http://drupal.org/node/305747
thanks for your griff, I have
thanks for your griff,
I have done everything according the tutorial. But it id not work for me.At least not at all.
I have problem with javascript function imageDetails or with response variable.
after I run ajax, my page is loading neverending. When I give this line to comment
I see result in my console in firebug, so I think result is ok?
I have very simple data in my function in my module
can you try this
$('#photo-container').html(result.data);
change .photo-container to #photo-container and let me know if it solves your problem. we usually give div id appended with #before and render html in the div.
I created test div <div
I created test div
I added it in page.tpl
then I used
$('#test-ajax').html(result.data);
Unfortunately, this does not work, too.
I have this js function:
When I look in firebugconsole I see this:
(do not click on the links, it is only sample, how my output looks)
GET http://www.myweb.sk/mypath
my test log
GET http://www.myweb.sk/misc/jquery.js...
GET http://www.myweb.sk/misc/drupal.js...
..and so on. Output of all modules follows and then whole website disappear and blank page appears, but keeps loading neverending.
I do not know where is problem.
When I comment this line
I see only this output in firebug console
GET http://www.myweb.sk/mypath
my test log
without loading whole site
I think I know where I made
I think I know where I made mistake but I cannot fix it. I have this sample code in mymodule.module file
but this code is never applied. I can comment whole code and nothing changed on my page. How do I force Drupal site to go through this code? I thought that I should go on page 'photos/get/photos', then I add click() function to some css selector on the site and it is done
Should I use another selector than "a" tag?