Example #1
0
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<h1>Index View</h1>

<div><?php 
echo $this->_viewBag->getData();
?>
</div>
<?php 
?>
<hr/>
<?php 
?>

<?php 
\Framework\AjaxViewHelper::init()->initForm($this->getPath() . "help/jsonroutes", "put")->initCallback("function( msg ) {\n            console.log( \"Data Saved: \" + msg );\n        }")->render(true);
?>
</body>
</html>
Example #2
0
<h1>Ajax test</h1>
<button id="btn" class="btn btn-default" onclick="send()">Submit Ajax</button>
<div id="#"></div>
<script>
    function send() {
        <?php 
\Framework\AjaxViewHelper::init()->initForm($this->getPath() . "help/jsonroutes", "put")->initCallback("function( msg ) {\n           document.getElementById(\"#\").innerHTML = msg;\n        }")->render(true);
?>
    }
</script>