79480584

Date: 2025-03-03 09:16:33
Score: 2
Natty:
Report link

I just started with CodingNight version 4. I applied some of the settings mentioned in other questions about the csrf issue, but nothing happened. What settings should I do for this part?

    <div class="col-md-12" style="margin-top:2%" >
        <div class="col-md-2 hidden-sm hidden-xs" >
        </div>
        <div class="col-md-8 col-sm-12 col-xs-12"  align="center">
            <img src="<?php echo base_url(); ?>img/logoavayar.jpg">
        </div>
        <div class="col-md-2 hidden-sm hidden-xs" >
        </div>
    </div>


    <input type="text" id="phonenumber" name="phonenumber" class="form-control" placeholder="Phone number">
<button type="button" id="sendotp" name="sendotp" class="btn btn-primary btn-block">Sign Up</button>

    <div class="col-md-12" style="margin-top:1%; margin-bottom:1%;" >
        <div class="col-md-4 hidden-sm hidden-xs" >
        </div>
        <div class="col-md-4 col-sm-12 col-xs-12"  align="center" style="background-color: #d7dddf;   border: 1px solid gray; border-radius: 2px; gray solid; padding: 1%;">
                <div class="form-group">
                   <label for="exampleInputEmail1"> نام کاربری </label>
                    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="در این قسمت نام کاربری را وارد کنید">
                
                    <input type="text" class="form-control" id="hhhhhhhh" aria-describedby="emailHelp" value="99x" placeholder="ای ریپ">

                
                
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">رمز عبور </label>
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="در این قسمت رمز عبور را وارد کنید" style="margin-bottom:4%">

                <button type="button" class="btn btn-primary">ارسال</button>
        </div>
        <div class="col-md-4 hidden-sm hidden-xs" >
        </div>
    </div>

    <div class="col-md-12" style="color:#000; font-size:20px">
        <hr/>
        <div class="col-md-12" style="color:#000; font-size:10px">
                <p>معاونت فنی صدا و سیمای مرکز فارس </p>
         </div>
    </div>

    <script type="text/javascript">



  $(document).ready(function(){
        
 $('button').click(function() {

$.ajax({
 url: "http://localhost:4499/Avayar2/public/index.php/Home/testakk/",
 type: 'post',
 headers: {'X-Requested-With': 'XMLHttpRequest'},
 dataType: 'json' ,
 contentType: 'application/json; charset=utf-8',

    data: {
    toto: 'dibd',
    koko: 'qqqq'
 },
 
 success: function(data2) {
        alert(data2.sdf)
 },
 error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
}); //end ajax
});




});




</script>

and controller is:


    public function testakk(){


        if ($this->request->isAJAX())
{
    
    $request = \Config\Services::request();


    $aaa= $this->request->getJsonVar('toto');
    
       $data2['sdf']= $aaa;
   
       echo json_encode($data2);
}



    
}

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: raziyeh