Returning a value from a script called via ajax

Returning a value from a script called via ajax

Howdy, I've got a form that has some dynamically produced content via jQuery, anyhoo, I've also got a few fields that when submitted, fires off a call to an ajax script to then run a php script that performs some database work.

Now, the issue I'm having is trying to action the return value of the php code. I'm firing off the ajax via...

         var ajaxPost = {
            type:   "post",
            url:   "/my_php_script.php",
            data:   "&value1=hello&value2=rob",
            success: function(addToForm) {
                  // COME BACK AND PERFORM SOME CHANGES TO THE HTML ON THE PAGE
               }
            };


...it's the success: function(addToForm) { bit that I can't seem to work how I'd like it to. Ideally, what I want is to collect a return value from the php script and either action this before or after the success bit in the jQuery. The php is just some calls to the db that check and insert stuff, it's here that I want to set a 'return' value for use in the jQuery.

Anyone tackled this before, any ideas?