Hi i've two wordpress sites where i wish to have ajax jsonp data transfers together.

<script type="text/javascript">
    $(document).ready(function() {

    $.ajax({  
        type: "POST",  
        url: "http://www.testsite.com/",  
        data: {test1:'<?php echo $_REQUEST['test1'] ?>',test2:'<?php echo $_REQUEST['test2'] ?>'}, 
        crossDomain: true, 
        dataType: "jsonp",
        success: function() {  
            <?php
            header("Location: ". $_SERVER['HTTP_REFERER']); //refresh
            ?>

        }
        return false;  
    });

</script> 

And it doesn't use

header("Location: ". $_SERVER['HTTP_REFERER']); //refresh

This line. It appears which i doesn't run the ajax/jsonp request whatsoever , nothing happens, nothing works.

But when i remove this line it really works not surprisingly!!!

Since i have actually need this line (to reload page), i dont get sound advice ? any ideas how you can overcome this (how you can run ajax script completely after which refresh site)?

Thanks.

PHP is server side, JavaScript is client side.

You can't execute PHP with JavaScript.

Rather use window.location of JavaScript. Doc: http://www.tizag.com/javascriptT/javascriptredirect.php