php - error 500 (Internal Server Error) with using ajax in codeigniter -
i used simple ajax function in code , it's work in local host, when upload code did not work! script in view:
<script type="text/javascript"> function active(int) { if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("frm_radio").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","<?php echo site_url("admin/groups/active_img/".$gallery_name."/".$gallery_id)."/"?>"+int,true); xmlhttp.send(); } </script> and html code:
<form id = "frm_radio"> . . . <input type="radio" id="radio" name="active" value="'.$item -> id.'" onclick="active(this.value)"/> . . . </form> and in controller have function name active_img
function active_img($gallery_name, $gallery_id, $itemid) { $name = $gallery_name . "_id"; $actived = $this -> gallery_model -> getitems(null, array("active" => 1, $name => $gallery_id)); $actived[0] -> active = 0; $this -> gallery_model -> additem($actived[0], $actived[0] -> id); $insert_vars["active"] = 1; $this -> gallery_model -> additem($insert_vars, $itemid); return true; } there radio button chose image must active , , when called function active_img , change value in data base , return true, worked in localhost in server it's not working! , when debug code error :
get http://example.com/admin/groups/active_img/products/4/10 500 (internal server error) 4:146 active 4:146 onclick 4:183 xhr finished loading: "http://example.com/admin/groups/active_img/products/4/10".
it's php error reason explained in error_log. there error_log in root directory of web site? there logs folder somewhere else? reason detailed in there.
if use .htaccess check again.
Comments
Post a Comment