Nivec
04-29-2013, 10:25 PM
Hi all,
I have a script that does the following:
$.ajax({
type: 'POST', url: './misc.php',
data: { 'do': 'cloc',
'action': 'updatevp',
'X': X,
'Y': Y}
})
Then in the Plugin, hook ?misc_start?, I have:
if($_REQUEST['do'] == 'cloc') {
switch($_REQUEST['action']) {
case ' updatevp':
$vbulletin->db->query_write("UPDATE MyCustomTable SET X = {$vbulletin->input->clean_gpc('r', 'X', TYPE_NUM)}, Y = {$vbulletin->input->clean_gpc('r', 'Y', TYPE_NUM WHERE fkiUserID = {$vbulletin->userinfo['userid']}");
break;
}
}
It works fine if do this:
$.ajax('./misc.php?do=cloc&action=updatevp&X=' + X + '&Y=' + Y)
Why can I not ?POST? it?
I am creating or at least trying to create my first pluging, so all this is a little new to me, am I missing something simple?
Thanks
I have a script that does the following:
$.ajax({
type: 'POST', url: './misc.php',
data: { 'do': 'cloc',
'action': 'updatevp',
'X': X,
'Y': Y}
})
Then in the Plugin, hook ?misc_start?, I have:
if($_REQUEST['do'] == 'cloc') {
switch($_REQUEST['action']) {
case ' updatevp':
$vbulletin->db->query_write("UPDATE MyCustomTable SET X = {$vbulletin->input->clean_gpc('r', 'X', TYPE_NUM)}, Y = {$vbulletin->input->clean_gpc('r', 'Y', TYPE_NUM WHERE fkiUserID = {$vbulletin->userinfo['userid']}");
break;
}
}
It works fine if do this:
$.ajax('./misc.php?do=cloc&action=updatevp&X=' + X + '&Y=' + Y)
Why can I not ?POST? it?
I am creating or at least trying to create my first pluging, so all this is a little new to me, am I missing something simple?
Thanks