Why do I get random text appended to my STOMP protocol messages? - php

I'm having an issue where I'm able to write many json encoded arrays to HornetQ without any problem, but when I try to read the frames back, every n'th message has random text appended to it (usually MESSAGE or RECEIPT).
Example:
I send the following to HornetQ:
{"data":9933753,"more_data":"Some Text"}
and I get back the following when I read the frame body:
{"data":9933753,"more_data":"Some Text"}
MESSAGE subscription:subscription/jms.queue.testing.qa.myqueue message-id:1310
destination:jms.queue.testing.qa.myqueue expires:0 redelivered:false priority:4 timestamp:1382637077839
I read the STOMP protocol definition and I still don't get how I can get back just the json string that I sent without the extra text seeing as the MESSAGE is in the body itself (making it impossible to decode it back without doing hacky string manipulations).
I have the following setup:
HornetQ (latest)
PHP 5.4
STOMP library: http://stomp.fusesource.org/documentation/php/book.html
Any suggestions are appreciated!

It's a bug probably. there was a fix around that at some point as I remember. If you are still seeing it with the latest version you have to provide a testcase to the developers and we would gladly fix it. I'm speaking here as one of the developers.
But first check if you are on the latest version. (2.3.0+ or 2.4.0 beta), or any latest EAP version.

Related

Python-CGI environment set-up?

I am doing a project in Natural Language Processing using nltk in python.
The block structure of project is as follows:
Interface (in php) ->
[NLP Engine] (in python) ->
API calls (in php) ->
Result (in php)
The input is supposed to go via GET method from PHP Interface to the Python Engine.
Background:
I have created a virtual host (url=/linguistics/) server using Easy-PHP Dev Server (Location=D:\Computational_Linguistics). I have enabled it so that it can execute Test.py so that when I type linguistics/Test.py, it executes.
Issue:
The basic CGI was successfully executed and I could see the output in Chrome. But as soon as I imported another module, it returned this error:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
End of script output before headers: engine.py
If you think this is a server error, please contact the webmaster.
Error 500
linguistics
Apache/2.4.4 (Win32) PHP/5.5.0
When I do NOT import nltk (or any other non-standard package) it works.
I did do the websearch to find the solution, and came to know I have to setup some environment variables to make it work.
But, I can not figure out how.
My code:
#!C:/Python27/python.exe
import nltk
from nltk import *
import re
import cgi, cgitb
inpt=cgi.FieldStorage()
str_in = inpt.getvalue('query')
def is_noun (str):
tags=nltk.pos_tag(nltk.word_tokenize(str))
for i in tags:
if i[1][1]=='N' or i[1][1]=='V': #Finding out the Nouns and the Verbs.
print "<h5>%s is a noun.<h5>" %i[0]
is_noun(str_in)
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print "<body>"
is_noun(str_in)
print "</body>"
print "</html>"
Since I received no answers (Not blaming anyone!) I read more documentations. As I have described in my Problem statement above, only NLP engine is written in Python. And, the problem exists in CGI environment only.
Hence My solution:
I modified engine.py to recieve input as commanline arguments, and then process upon it. It returns the processed data (In a exact format) back to buffer stream.
I used exec() command in PHP to do so.
The project is on GitHub, so If anyone wants to have a look at it, he's most welcome!
PS: I still don't know the reason for that error. I am hell sure that all environment paths were correct. So I'd call this answer a work-around, rather than a solution.
PPS: I am answering my own question, so that If anybody have same problem, they might consider this work around.
The problem is that you run is_noun twice, and the first one before you sent any headers. Hence, the error.
Another problem is that str_in is str, but I think nltk.pos_tag expects unicode. that is you need to decode the str_in value (if you use any symbols outside plain ASCII. That is you should do it anyway, but you will notice only if there will be such a character in the input):
str_in = unicode(inpt.getfirst('query', ''), 'utf-8')
and then, when you print unicode, you will need to encode it back:
print "<h5>%s is a noun.<h5>" % i[0].encode('utf-8')
But, in its current form it might be looking garbled in the browser, because you need to notify the browser, that the charset is 'utf-8', that is you need to change the content-type header:
print "Content-Type: text/html; charset=utf-8"
print
P.S. Hopefully, this is all for local use only and not available from the internet, because this should be much more complicated.

Some markup mysteriously goes missing when send to server using ajax (POST) as string

OS: Windows 7 (64-Bit)WAMP Version: 2.2Apache Version: 2.2.22PHP
Version: 5.4.3Framework: CodeIgniter 2.1.2
Hi, I am experiencing something strange, and can't seem to pinpoint the cause. I am sending a js object to server to be saved in db in BLOB. The object is converted to JSON string using JSON.stringify() before sending it in Ajax(POST) call.
Object After Using JSON.stringify
[{"page_id":"1","site_id":456,"composite_id":"456-1-text-1","type":"2","properties":"{\"id\":\"text-1\",\"isModified\":false,\"isNew\":false,\"name\":\"Text 1\",\"content\":\"<span style=\\\"text-decoration:underline;font-size:x-large;color:#7092be;background-color:#c8bfe7;\\\"><strong>Your text here</strong></span>\",\"keywords\":\"\",\"top\":103,\"left\":119,\"width\":130,\"height\":30,\"style\":{\"borderColor\":\"#1e07da\",\"borderSize\":\"2\",\"borderRadius\":\"6\",\"shadowType\":\"drop-shadow\",\"shadowColor\":\"#000000\",\"shadowSize\":\"0\",\"shadowBlur\":\"0\",\"boxShadowColor\":\"#000000\",\"boxShadowPosX\":\"3\",\"boxShadowPosY\":\"2\",\"boxShadowBlur\":\"5\",\"boxShadowType\":\"\",\"zIndex\":2020}}"}]
This is the concerning part from above string that gets modified(Key-Value Pair):
\"content\":\"<span style=\\\"text-decoration:underline;font-size:x-large;color:#7092be;background-color:#c8bfe7;\\\"><strong>Your text here</strong></span>\"
I send this string to api controller using ajax. When I receive it in the controller I use print_r() to print the variable. But now insted of the above mentioned part this is what I receive:
[{"page_id":"1","site_id":456,"composite_id":"456-1-text-1","type":"2","properties":"{\"id\":\"text-1\",\"isModified\":false,\"isNew\":false,\"name\":\"Text 1\",\"content\":\"<span ><strong><em>Your text here</em></strong></span>\",\"keywords\":\"\",\"top\":103,\"left\":119,\"width\":130,\"height\":30,\"style\":{\"borderColor\":\"#1e07da\",\"borderSize\":\"2\",\"borderRadius\":\"6\",\"shadowType\":\"drop-shadow\",\"shadowColor\":\"#000000\",\"shadowSize\":\"0\",\"shadowBlur\":\"0\",\"boxShadowColor\":\"#000000\",\"boxShadowPosX\":\"3\",\"boxShadowPosY\":\"2\",\"boxShadowBlur\":\"5\",\"boxShadowType\":\"\",\"zIndex\":2020}}"}]
As you can see the concerned part is missing the style settings and is now modified to:
\"content\":\"<span ><strong><em>Your text here</em></strong></span>\"
I have been searching it over the internet, but it does not seem to be a common problem as I cant find anything related to it. So now I am counting on SO.
Regards
UPDATE:
I used var_dump($_REQUEST)as suggested by #BogdanBurim. And this is the concerned part:
\"content\":\"<span style=\\\"text-decoration:underline;font-size:x-large;color:#7092be;background-color:#c8bfe7;\\\"><strong>Your text here</strong></span>\"
As you can see the style settings are still there. So with we come to the decision that CI filters might be removing this part from string. So now the question is how to fix this issue?
Well after discussion with #BogdanBurim, I came to conclusion that to avoid XSS to some extent CI removed any text included within quotes and double quotes, from data sent to server.
There was an option to extend CI_Input library to allow selective disabling of XSS filter. That would solve my issue but would raise security concerns. So instead what I did is I encode (base_64) the data before sending it to the api. It is saved in DB as BLOB. And when fetched is decoded on client side.

Wordpress XMLRPC API post (html) error parse error not well formed

I am using Wordpress's XMLRPC API and the IXR_Library php class for WP API. wp.newPost is working normally if I use plain text or just simple text in body/content of the post but when I am posting a autocreated full html/shortcode content, it always gives me this error
Array ( [faultCode] => -32700 [faultString] => parse error. not well formed )
The content I am trying to post is a post content I normally use within WP with shortcodes but I want to post it via php using API since I am trying to automate my blogging.
You can check the body/content I am trying to post below
http://pastebin.com/U94XVZGT
Thats the content thats shown in XML debug mode (probably seems already html encoded)
Below is the full XML call and response returned via debugging, have removed user/pass from it
http://pastebin.com/26Nyx97K
I would really appreciate any possible help, I have already tried php's htmlentities and htmlspecialchar functions to encode my body and even tried str_replace to replace[ ] brackets in thought that they might be causing it
Again, its certainly due to the content code as I tried just a Hello World plain content and it worked ------------------------------------------------------------
A Update, earlier I was getting the html content from a textarea using $_POST, just now I tried to use same content in same variable but used ' ' single quotes instead around the content body and now posting works but I get a error
Warning: strpos(): Empty delimiter in wp-includes/class-wp-xmlrpc-server.php on line 4338
So if I use $body=$_POST['body']; it doesnt works and gives main error but directly using $body=' htmlcontent inside '; works but gives above strpos error
Please try adding the xml package:
sudo apt-get install php-xml
, this has resolved my problem.
TO anyone else having this problem, I fixed it. At end of it seemed the problem was due to wrong character encoding, I needed to Pass UTF8 but the content was being passed in some other char encoding (windows one) making some text and other languages not parseable, I modified my code to make it UTF 8 and now it works
I've changed my password to contain no symbols and it solved the issue.
I'm still not sure what broke everything initially but you might as well try changing it and trying again and see if that works for you.
To anyone else having this problem, it might also relate to WordPress bug #18310.
There is a patch for WordPress available at http://core.trac.wordpress.org/attachment/ticket/18310/18310-3.diff
See the WordPress bug report on their trac install at http://core.trac.wordpress.org/ticket/18310

Baffled: PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0?

I have found that one common reason for the error is an exception being thrown from within an exception handler. I'm quite sure this doesn't happen in the application I'm trying to debug... But I've put all the initialization processing lines at the top of index.php in a try/catch.*
It can apparently also happen because some things cannot be serialized to be stored in a session. At most this application stores arrays into the session (quite a bit), but I'm confident that it doesn't store anything too out of the ordinary in it.
Someone commented that it happened to them because their primary key needed to be CHAR(32) instead of INT(11). The PK's in this app are all INTs.
Other suggestions are that it could be a problem with PHP 5.3.3 fixed in 5.3.6, full disk, and a need to typecast a SimpleXML value. We do happen to be running PHP 5.3.3, but upgrading would have to be a last resort in this case. It hasn't always been doing this.
UPDATE/NOTE: I actually can't reproduce the error myself, only see it happening in the logs, see below paragraph for where I believe the error is happening...
* From the error logs, it seems likely that at least one place it is happening is index.php. I am deducing this only because it is indicated in some entries by a referring URL. The try/catch code is currently only around the "top" initialization portion of the script, below that is mostly the HTML output. There is some PHP code in the output (pretty straightforward stuff though), so I may need to test that. Here is the catch part, which is not producing any output in the logs:
} catch (Exception $e) {
error_log(get_class($e)." thrown. Message: ".$e->getMessage(). " in " . $e->getFile() . " on line ".$e->getLine());
error_log('Exception trace stack: ' . print_r($e->getTrace(),1));
}
Would really appreciate any tips on this!
EDIT: PHP is running as an Apache module (Server API: Apache 2.0 Handler). I don't think there are any PHP accelerators in use, but it could just be that I don't know how to tell. None of the ones listed on Wikipedia are in phpinfo().
As far as I can tell the MPM is prefork. This is the first I'd ever looked into the MPM:
# ./httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
The problem
In short you have a exception thrown somewhere, you have no idea where and up until now you could not reproduce the error: It only happens for some people, but not for you. You know that it happens for other people, because you see that in the error logs.
Reproduce the problem
Since you have already eliminated the common reasons you will need to reproduce the error. If you know which parameter will cause the error it should be easy to locate the error.
Most likely it is enough if you know all the POST/GET parameters.
If you can't reproduce with just these, you need to know additional request headers. Such as user agent, accept-encoding,...
If you still can't reproduce, then it becomes very difficult: The error may depend on a state (a session), the current time, the source ip address or the like.
The custom log method
Let's start simple: To get all parameters you can write in the very beginning of the affected php file something like:
file_put_contents("/path/to/some/custom_error_log", date()."\n".print_r(get_defined_vars(), true), FILE_APPEND | LOCK_EX);
Don't forget that the custom_error_log file must be writable to your php application. Then, when the error occurs in the error log, find the corresponding lines in your custom_error_log file. Hopefully there are not to many requests per second so that you can still identify the request. Maybe some additional parameters in the error log like source ip can help you identify the request (if your error log shows that).
From that data, reconstruct a request with the same POST/GET parameters.
The tcpdump method
The next option that is very simple as well, but requires you to have root-access on your target machine is to install tcpflow. Then create a folder, cd into that folder and simply execute (as root) tcpflow "port 80". The option (port 80) is a pcap filter expression. To see all you can do with that, see man pcap-filter. There is a lot what these filter expressions can do.
Now tcpflow will record all tcp connections on port 80, reconstruct the full data exchange by combining the packages belonging to one connection and dump this data to a file, creating two new files per connection, one for incoming data and one for outgoing data. Now find the files for a connection that caused an error, again based on the timestamp in your error log and by the last modified timestamp of the files. Then you get the full http request headers. You can now reconstruct the HTTP request completely, including setting the same accept-encoding, user-agent, etc. You can even pipe the request directly into netcat, replaying the exact request. Beware though that some arguments like a sessionid might be in your way. If php discovers that a session is expired you may just get a redirect to a login or something else that is unexpected. You may need to exchange things like the session id.
Mocking more things
If none of this helps and you can't reproduce the error on your machine, then you can try to mock everything that is hard to mock. For example the source ip adress. This might make some stunts necessary, but it is possible: You can connect to your server using ssh with the "-w" option, creating a tunnel interface. Then assign the offending ip adress to your own machine and set routes (route add host ) rules to use the tunnel for the specific ip. If you can cable the two computers directly together then you can even do it without the tunnel.
Don't foget to mock the session which should be esiest. You can read all session variables using the method with print_r(get_defined_vars()). Then you need to create a session with exactly the same variables.
Ask the user
Another option would be actually ask the user what he was doing. Maybe you can follow the same steps as he and can reproduce.
If none of this helps
If none of that helps... well... Then it gets seriously difficult. The IP-thing is already highly unlikely. It could be a GEO-IP library that causes the error on IPs from a specific region, but these are all rather unlikely things. If none of the above helped you to reproduce the problem, then you probably just did not find the correct request in all the data generated by the custom_log_file-call / tcpflow. Try to increase your chances by getting a more accurate timestamp. You can use microtime() in php as a replacement for date(). Check your webserver, if you can get something more accurate than seconds in your error log. Write your own implementation of "tail", that gives you a more accurate timestamp,... Reduce the load on the system, so that you don't have to choose from that much data (try another time of day, load of users to different servers,...)
circle the problem once you can reproduce
Now once you can reproduce it should be a walk in the park to find the actual cause. You can find the parameter that causes the error by trial and error or by comparing it to other requests that caused an error, too, looking for similarities. And then you can see what this parameter does, which libraries access it, etc. You can disable every component one by one that uses the parameter until you can't reproduce anymore. Then you got your component and can dive into the problem deeper.
Tell us what you found. I am curious ;-).
I had such an error, too. Found out that I returned a sql object in my session class (that was used by the session_handler) instead of returning nothing or at least not the sql object. First look into your _write and _read methods, if you too return some incorrect stuff.
Notice: ... Unknown on line 0 - How to find correct line, it's NOT "line 0"
I realize this question has already been answered, but I'll add this since it may help someone:
I managed to (unintentionally) produce errors without a stack frame from a function which used its own error handler to maintain control of execution while calling a potentially "dangerous" function, like this:
// Assume the function my_error_handler() has been defined to convert any
// PHP Errors, Warnings, or Notices into Exceptions.
function foo() {
// maintain control if danger() crashes outright:
set_error_handler('my_error_handler');
try {
// Do some stuff.
$r = danger();
} catch (Exception $e) {
$r = 'Bad Stuff, Man!';
}
restore error_handler();
return $r;
}
The "untraceable failure" would happen at the end of the program execution if the logic in "Do some stuff" returned from foo() directly, bypassing the call to restore_error_handler(). What I took away from the experience is this:
PHP maintains a stack of error handlers which gets deeper/taller with each call to set_error_handler().
Bad Stuff can happen if you push error handlers onto the stack and don't clean up after yourself before the program exits "normally".
This was a tough bug to isolate - I basically narrowed the problem down to the above function and then stared at it until my eyes bled.
So how would I have tracked this down, knowing what I know now? Since I don't know of any way to inspect the PHP error handler "stack" directly, I'm thinking it might make sense to use a Singleton object to encapsulate all set/restore operations for PHP error handlers. At least then it would be possible to inspect the state of the Singleton before exiting the program normally, and if "dangling" error handlers are detected to generate a sensible failure/warning message before PHP freaks out.
Instead of wrapping code in a try/catch block, what happens when you register an exception handler? Clearly your try/catch block is not catching the exception, thus resulting in the errors logged to Apache. By registering a handler, you can be sure any uncaught exception is handled.
Also, if you're using namespaces in your application, make sure you write \Exception in your catch block (or include the Exception class via a use statement).
This may be a little late but one issue I discovered when moving a site from a local to a remote server. I was using Concrete5 cms had developed my site locally(windows 8 in xampp) and then uploaded to a remote server running Cent 0S
Windows mysql by default is case insensitive and created a lower case database. Once this was uploaded to the remote server I received the "Exception thrown without a stack frame in Unknown on line 0?"
I then corrected the database tables case and my site started working again.
For us, this error was due to inadvertently serializing SimpleXML objects.
If you are using SimpleXML objects with 5.3.3, make sure you are are casting the node values to whatever you need (e.g. string) if you are serializing the values in the session.
Before:
$token = $response->Token->Value;
/* token saved in session, results in line 0 error */
After:
$token = (string) $response->Token->Value;
/* token saved in session, no error */
I had completely the same error. A very spacial case: if you connect an unnamed function (closure) hook to an object instance's hook point. After that you try to serialize this object.
I had the same error after filling the Illuminate Eloquent model's Fillable property incorrectly. Note the last 3 elements of the array, one is missing a coma.
protected $fillable = [
'budget',
'routestatus' ,
'userroutenumber'
'totalmovingseconds',
'totalidleseconds'
];
I had the same error, it appeared upgrading server from centos 5 to centos 6 and downgrading PHP from 5.4 to 5.3. Actual issue was PHP apc, not configured properly. Check your APC. I was using Symfony2, so you might find some help at Symfony Unable to allocate memory for pool
one simple way to produce this error is an old server with register_globals = On. then you only need two lines of code:
<?php
$_SESSION["my_var"] = "string";
$my_var = new MyClass(); //could be any class, i guess
?>
as soon as you reload this page once, you'll get the Exception thrown without a stack frame in Unknown on line 0 - error. seems like there is a conflict between the instance of the class and the (session) variable.
at least this is how i got this annoying error which is so hard to debug.
This problem occurred for me when I changed the namespace on a few Symfony bundles. Deleting the files in the the symfony cache directory fixed the issue.
Likely you have a corrupt/inconsistent table in the database. Try dumping the database. If you get a error that's the time. Repair that table and the issue should go away.
It is for this reason why clean install works. The clean install is just that clean.
mysqlcheck should work but if it does not show and issue still do above.

Can't send content-type: text/xml header from PHP at the same time getting the data from MYSQL

i hope you can cast some light on my problem. I need to do an AJAX / PHP / MYSQL application to display posts and stuff on the page i'm writing.
I only discovered how to do some simple stuff in PHP after taking some mushrooms but that was years ago and now i don't have mushrooms and i'm just stuck!
So here's the problem:
i think i need to send a proper "xml" file through php so the ajax part can take it but: when i try to put the header on top of the php it displays this error:
" Extra content at the end of the document "
When i looked at some tutorials people were using the "header" fearlesly to do such stuff as i want to do and no comments suggested that it didn't work. so why it doesn't work on my local server?
I'm running:
WAMP
Apache 2.2.11
PHP 5.3.0
It also doesn't work on a remote server (PHP 5.3.0) :/
I read all the stuff i could find till 5am and decided to ask you for help for the first time :)
Thank you!
header('content-type: application/xhtml+xml; charset=utf-8');
require_once("allyouneed.php");
require_once("bazingablob.php");
$category=$_GET["category"];
$post_tags=$_GET["post_tags"];
$language=$_GET["language"];
$author=$_GET["author"];
$posts_per_page=$_GET["posts_per_page"];
$current_page=$_GET["current_page"];
$order=$_GET["order"];
$hard_limit=$_GET["hard_limit"];
$show_hidden=$_GET["show_hidden"];*/
$wypluj="";
$wypluj="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
$bazinga_blob = new bazingablob;
if (!$bazinga_blob->connect_to_database())
{
$wypluj.="<IsOK>0</IsOK>";
echo $wypluj;
exit;
}
else
{
$wypluj.="<IsOK>jedziem</IsOK>";
}
$bb_result=$bazinga_blob->get_all_posts($category,$post_tags,$language,$author,$posts_per_page,$current_page,$order,$hard_limit,$show_hidden);
if ($bb_result) //udalo sie cos znalezc w bazie wedlug kryteriow
{
$wypluj.="<Pagination>";
$wypluj.="<CurrentPage>";
$wypluj.=$bazinga_blob->posts_pagination["current_page"];
$wypluj.="</CurrentPage>";
$wypluj.="<LastPage>";
$wypluj.=$bazinga_blob->posts_pagination["last_page"];
$wypluj.="</LastPage>";
$wypluj.="<PostsCount>";
$wypluj.=$bazinga_blob->posts_pagination["posts_count"];
$wypluj.="</PostsCount>";
$wypluj.="</Pagination>";
$wypluj.="<Posts>";
foreach ($bb_result as $item)
{
$wypluj.="<Post>";
$wypluj.="<PostId>".$item->post_id."</PostId>";
$wypluj.="<PostAuthor>".$item->post_author."</PostAuthor>";
$wypluj.="<PostLangId>".$item->post_langid."</PostLangId>";
$wypluj.="<PostSlug>".$item->post_slug."</PostSlug>";
$wypluj.="<PostTitle>".$item->post_title."</PostTitle>";
$wypluj.="<PostGreetingPicture>".$item->post_greeting_picture."</PostGreetingPicture>";
$wypluj.="<PostGreetingVideo>".$item->post_greeting_video."</PostGreetingVideo>";
$wypluj.="<PostGreetingSound>".$item->post_greeting_sound."</PostGreetingSound>";
$wypluj.="<PostShort>".$item->post_short."</PostShort>";
$wypluj.="<PostBody>".$item->post_body."</PostBody>";
$wypluj.="<PostDate>".$item->post_date."</PostDate>";
$wypluj.="<PostPublished>".$item->post_published."</PostPublished>";
$wypluj.="<PostSticky>".$item->post_sticky."</PostSticky>";
$wypluj.="<PostComments>".$item->post_comments."</PostComments>";
$wypluj.="<PostProtected>".$item->post_protected."</PostProtected>";
$wypluj.="</Post>";
}
$wypluj.="</Posts>";
}
echo $wypluj;
The error comes from your browser and indicates that your XML is malformed.
Setting the application/xhtml+xml header tells the browser to process the document as serious XML. XML needs to be "well-formed", i.e. it must not contain any syntax errors. Apparently you do have a syntax error on line 1 at column 73, which makes the browser abort the attempt to process the document.
For this reason it's a pain to hand-code XML, you should really look into a library that takes care of the well-formedness for you, like PHP's own XMLWriter.
Have you validated your XML?
http://friendsofed.infopop.net/4/OpenTopic?a=tpc&s=989094322&f=5283032876&m=4521066061
I'm honestly not sure what you're trying to do with the header, it's not any Ajax method I've ever been taught. The header method you're doing looks just a few lines short of outputting the XML to a download prompt.
Here's my favorite way to do AJAX. Simple, understandable, and quick.
Include Jquery.
Setup your data--whether by form with a Serialize (gets form data into a Javascript Variable) or by just setting some variables as it seems you're doing above.
Send via Jquery Ajax to a separate processing page. The page will receive the data you setup as a $_REQUEST variable, with the method depending on whether you defined it as a POST or not (defaults to a GET)
The processing page --does-- stuff with the REQUEST data and may or may not respond back to the page. This is where you can do stuff like update divs, alert that it worked, etc.
Here's a great tutorial. Focus on the code under "Hello Ajax, Meet Jquery"
If you get yourself any more of those mushrooms, a PHP familiar way to do AJAX is with XAJAX. It allows you to do asynchronous calls to PHP functions. Be aware, though, that the forums are not the most english-friendly and documentation is a bit cryptic.

Categories