提取元素的HTML

I am trying to get the internal HTML of an HTML Tag, how can i do this so far i have tried this

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
    var x = parseInt("123");
    $("#getVal").html(x);
});

</script>
<?php
    $s = '<p id="getVal"></p>';
    echo strpos($s, ">");
    echo substr($s,15);

    $s = intval($s);
    echo gettype($s);
    echo intval($s)*2;
?>

after the last echo in php i just get 0 as result what i should i do to get the results. Ok I want to do is sending some numeric data from JS to PHP and then after performing some numerical operations on it i want to return that user, on the same page. I dont want to use AJAX.

If you want to extract the html, simply do

$("#getVal").html();

without passing any parameters to html()

If you want to extract the text, simply do

$("#getVal").text();

without passing any parameters to text()

To get the content of the element:

 $("#getVal").text();

In jQuery, most of methods works as both getters and setters function. For example,

If you want to get something, like html content from an element, use the getter syntax

$("#getVal").html();

If you want to set something, like setting html content to an element, use the setter syntax.

$("#getVal").html("Hello dude!");