vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Post reply from external page using AJAX (https://vborg.vbsupport.ru/showthread.php?t=242155)

Fraik 05-09-2010 01:27 PM

Post reply from external page using AJAX
 
I am currently trying to write a relatively simple script (or so I thought) using jQuery and Ajax. The goal is to allow users to reply to forum threads from my website.

I am already using the vB - Wordpress bridge, so it would be sweet if users could post from the site instead of having to go to the forum thread first.

Here's the code I have thus far:
Code:

<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
$("form#vbform").submit(function(){ 
 $.post("http://middleearthcenter.com/forums/newreply.php?do=postreply",{ 
      message: $("#vB_Editor_001_textarea").val(), 
      do: "postreply", 
      secuiritytoken: "ENTER_TOKEN_HERE",
        t: $("#t").val()
    }, function(xml) { 
  $("#msg").append("RETURNED:"+xml); 
 }); 
 return false; 
});
});
</script>
</head>
<body>

<div id="msg"></div>
<form id="vbform" name="vbform">
Message<br />
<textarea name="message" id="vB_Editor_001_textarea" rows="10" cols="60" style="display:block; width:540px; height:250px" tabindex="1" dir="ltr">
</textarea><br />
Thread number<br />
<input type="text" id="t" name="t" value="20791" /><br /><br />
<input type="submit" value="submit message" />

</body>

Now, using Charles to see the results, it does appear to work except for one vital issue. It is not sending along or using my user login info (I have included global.php on the page in question).

Question is how do I post as the user I'm logged in as. At the moment it doesn't seem to use that data and simply tries to post as a guest.

Any help would be appreciated!


All times are GMT. The time now is 07:07 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01017 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete