This is the ajax code {code ...} this is the code controlled by the ci framework {code ...} no id value exists in echo, and no reason can be found .... is it because the data is no longer in the past? I can use another deleted ajax function without redirecting to the Controller. What if I want to transfer data to the Controller and redirect ?... This is the ajax code.
$(".glyphicon-pencil").click(function(){ var id = $(this).attr('rel'); var URL = "
"; $.ajax({ type:'post', url:URL, data:{"id" : id}, success:function(msg){ window.location.href="
"; } }); });
This is the code controlled by the ci framework.
public function update(){ $id = $this->input->post('id'); echo "$id"; exit; $thisdata = $this->News_model->getContent($id); $data['update'] = $this->News_model->getall(); $data['id'] = $thisdata['id']; $data['title'] = $thisdata['title']; $data['content'] = $thisdata['content']; $data['children'] = $thisdata['children']; $this->load->view('admin/update',$data); }
No id value exists in echo, and no reason can be found ....
Is it because the data is no longer in the past? I can use another deleted ajax without redirecting to the Controller.
What should I do if I want to transfer data to the Controller and redirect it?
I am confused about this problem when I got started ..
Reply content:
This is the ajax code.
$(".glyphicon-pencil").click(function(){ var id = $(this).attr('rel'); var URL = "
"; $.ajax({ type:'post', url:URL, data:{"id" : id}, success:function(msg){ window.location.href="
"; } }); });
This is the code controlled by the ci framework.
public function update(){ $id = $this->input->post('id'); echo "$id"; exit; $thisdata = $this->News_model->getContent($id); $data['update'] = $this->News_model->getall(); $data['id'] = $thisdata['id']; $data['title'] = $thisdata['title']; $data['content'] = $thisdata['content']; $data['children'] = $thisdata['children']; $this->load->view('admin/update',$data); }
No id value exists in echo, and no reason can be found ....
Is it because the data is no longer in the past? I can use another deleted ajax without redirecting to the Controller.
What should I do if I want to transfer data to the Controller and redirect it?
I am confused about this problem when I got started ..
You are not using the returned data, and you will jump directly toupdate
Page now
You putwindow.location.href=" ";
This sentence is changedalert(msg)
Try
Select network debugging for F12 ~~
You have never used your templates and frameworks ~~
" "Can I parse it into a correct url? Is the value of the id passed by the front end blank? Network can be seen