I've implemented my module as follows:
<?php
function simpim_menu() {
$items['simpim/check_messages'] = array(
'page callback' => 'check_messages',
'type' => MENU_CALLBACK,
);
$items['simpim/writemessage'] = array(
'page callback' => 'writemessage',
'type' => MENU_CALLBACK,
);
$items['simpim/get_message'] = array(
'page callback' => 'get_message',
'type' => MENU_CALLBACK,
);
return $items;
}
?>
In my javascript file I have the following:
xmlhttp=$.ajax({
type: 'GET',
url: '/sports/sites/all/modules/simpim/simpim/writemessage/',
data: 'suid='+uid+'&sname='+uname+'&ruid='+partnerID+'&rname='+partner+'&msg='+sendText,
success: function(msg){
alert(msg);
}
});
return false;
});
I'm expecting Drupal to implement the 'writemessage' function as specified in the 'page callback' => 'writemessage', but this does not appear to be happening.
Is my implementation of this okay? Or is my grasp of the concepts of this way off?
my apache access.log has the following lines:
10.0.0.7 - - [17/Aug/2009:09:30:59 +0200] "GET /sports/sites/all/modules/simpim/simpim/check_messages?_=1250494232546&ruid=27 HTTP/1.1" 404 324 "http://bilbo/sports/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5"
10.0.0.7 - - [17/Aug/2009:09:31:03 +0200] "GET /sports/sites/all/modules/simpim/simpim/writemessage/?suid=1&sname=admin&ruid=27&rname=zed&msg=morning HTTP/1.1" 404 322 "http://bilbo/sports/?q=node/6" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)"
In this segment "GET /sports/sites/all/modules/simpim/simpim/writemessage/?suid=1&sname=admin&ruid=27&rname=zed&msg=morning HTTP/1.1" 404 the 404 seems to imply a 'File not found' error, but this may not necessarily be unexpected as the "/sports/sites/all/modules/simpim/simpim/writemessage/" file (or directory) does not exist.
Can anyone assist?
Comments
mhh
Its so long since i've looked at page callbacks but in the javascript just use
url: '/sports/sites/all/modules/simpim/writemessage/'
I appreciate the help.
Unfortunately no change.
As I understand it, if I put "http://bilbo/sports/sites/all/modules/simpim/writemessage/" I should get a blank page, but I get a 404.
The right url is
The right url is http://baseexample.com/simpim/writemessage
Also you need to implement the writemessage function
Eric
Thanks
One thing that's encouraging is that it seems I am going in the right direction even if I am not actually on the right track.
However, I still have the same result:
>Also you need to implement the writemessage function
I really cannot see what I'm
I really cannot see what I'm doing wrong.
Everything I read tells me that this should work but it doesn't.
I think there must be
I think there must be something wrong with my Drupal installation.
I've just installed the IM instant messenger module http://drupal.org/project/im and this doesn't appear to work either.
The im_msg database is not written to and the apache access.log returns the following information:
*_*
In Drupal, url means, the path, it does not include /sites/all/modules/mymodule/mymodule.module/mymenu
should be
Regards.
Regards.
🪷 Beautifulmind
Yes, I believe so. I have
Yes, I believe so.
I have since modified the javascript, but the results remain the same.
I'm tearing my hair out because AFAICT it *should* work, but doesn't.
*_*
Have you cleared the cache after modifying the menu?
Regards.
🪷 Beautifulmind
Have you cleared the cache
Yes.
And run update.php and cron. And remove the module and reinstall it.
I get the same results.
As I suspected...
As I suspected there appears to be something wrong with my Drupal install.
I have taken my scripts onto another server but am now gettin a 403 error.