The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi all,
I have a script that does the following: Code:
$.ajax({
type: 'POST', url: './misc.php',
data: { 'do': 'cloc',
'action': 'updatevp',
'X': X,
'Y': Y}
})
Then in the Plugin, hook ?misc_start?, I have: Code:
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: Code:
$.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 |
|
#2
|
|||
|
|||
|
Eventually found the problem, I had to pass the security token as well:
Code:
'securitytoken': SECURITYTOKEN Code:
$.ajax({
type: 'POST', url: './misc.php',
data: { 'do': 'cloc',
'action': 'updatevp',
'X': X,
'Y': Y,
'securitytoken': SECURITYTOKEN}
})
|
|
#3
|
||||
|
||||
|
Good job finding the issue
|
|
#4
|
||||
|
||||
|
... and thanks for posting the solution!
|
|
#5
|
|||
|
|||
|
Good job and thumbs up for posting the answer. Really makes the thread useful to the the community.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|