我必须调用位于同一文件中的javascript函数

After clicking send button. I have to pass these parameters to function but it is not working as I expected. If you understand it then please help. Below is button and function...

$pm_ui .= '<button type="submit" id="pmBtn" onclick="postPm(\''.$u.'\',\''.$log_username.'\',\'$pmsubject\',\'$pmtext\')">Send</button>';


function postPm(tuser,fuser,subject,ta){
var data = _(ta).value;
var data2 = _(subject).value;
if(data == "" || data2 == ""){
    alert("Fill all fields");
    return false;
}
_("pmBtn").disabled = true;
var ajax = ajaxObj("POST", "php_parsers/pm_system.php");
ajax.onreadystatechange = function() {
    if(ajaxReturn(ajax) == true) {
        if(ajax.responseText == "pm_sent"){
            alert("Message has been sent.");
            _("pmBtn").disabled = false;
            _(ta).value = "";
            _(subject).value = "";
        } else {
            alert(ajax.responseText);
        }
    }
}
ajax.send("action=new_pm&fuser="+fuser+"&tuser="+tuser+"&data="+data+"&data2="+data2);
}

But whenever I click on 'send' button it is not triggering function code is as following. If I am missing something then please help me to take my attention there..(button is not responding any thing...)

Ok, I made this test and it works

<?php 
$u = 'u';
$log_username = 'log_username';
$pmsubject = 5;
$pmtext = 4;
echo '<button type="submit" id="pmBtn" onclick="postPm(\''.$u.'\',\''.$log_username.'\','.$pmsubject.','.$pmtext.')">Send</button>'; 
?>

<script>
var postPm=function (tuser,fuser,subject,ta){
    console.log(tuser);
    console.log(fuser);
    console.log(subject);
    console.log(ta);
}
</script>

I hope it helps