Jquery Ajax is not working with Codeigniter
<p>I am a ajax beginner, Here I am trying to show a text box value in same page using Ajax. </p>

<p>My Controller code:</p>

<pre><code>&lt;?php
class Merchant extends CI_Controller
 {

    public function ajaxtest()
    { 

     $this-&gt;load-&gt;helper('url');
     $this-&gt;load-&gt;view('ajaxtest');
     $fullname = $this-&gt;input-&gt;post("fullname");
     echo $fullname;

    }
}
?&gt;
</code></pre>

<p>Here is my view code:</p>

<pre><code>&lt;head&gt;
 &lt;script src="&lt;?php echo base_url();?&gt;assets/js/jquery-latest.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){   

    $("#getinfo").click(function()
    {   

     $.ajax({
         type: "POST",
         url: "&lt;?php echo base_url(); ?&gt;merchant/ajaxtest",
         data: {textbox: $("#fullname").val()},
         dataType: "text",  
         cache:false,
         success: 
              function(data){                    
                $('#mytext').html(data);
              }
          });
     return false;
 });
 });

&lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;form method="post"&gt;
        &lt;input  type="text" id="fullname"/&gt;
        &lt;input  type="button" value="getinfo" id="getinfo"/&gt;      
      &lt;span id="mytext"&gt;&lt;/span&gt;
 &lt;/form&gt;

 &lt;/body&gt;
</code></pre>

<p>When I click on the button getinfo, I want to show the text inside the text box as span text. But now it shows nothing.. </p>

<p>Updated:</p>

<p>After experts' opinion, I edited some text(see my edit note), Now When i click on the button, it shows again a textbox and a button.. !!</p>

<p><a href="https://i.stack.imgur.com/zj3Kq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zj3Kq.jpg" alt="enter image description here"></a></p>