php - No 'Access-Control-Allow-Origin' header, the same server -
primary want say, i'm not sending requests domain, in similar questions. server.php located in the same domain
i have simple service share information original key. so, when in info field write link in first place, blank error
, otherwise, success
callback. >>page<<. simplified post method:
var post = function (key, value) { $.ajax('/server/server.php', { type: 'post', data: { "key": key, "value": value }, datatype: 'json', success: function (result) { if (!result.hasownproperty('error')) { showtooltip('good', 'normal', result.result); } else { showtooltip('bad', 'big', result.error); } }, error: function (requestobject, error, errorthrown) { showtooltip('bad', 'big', 'error ' + errorthrown); console.log(requestobject); } }); }
server.php code:
if(isset($_post['key'])&&isset($_post['value'])){ $key = $_post['key']; $value = $_post['value']; $iseternal = 0; $existed_result = mysql_query("select * `table` `key`='".mysql_real_escape_string($key)."'", $link); //$existed_rows = mysql_num_rows($existed); $num_rows = mysql_num_rows($existed_result); if($num_rows == 0){ //inserting table if(isset($result)){ $response = array( "result" => "info posted succesfully" ); echo json_encode($response); exit; }else{ $response = array( "error" => "error while posting" ); echo json_encode($response); exit; } }else { $response = array( "error" => "this key existed" ); echo json_encode($response); exit; } }
i can't figure out why happening, guys me please?
update: people http:// isnn't permitted server, why can't use iframe? (i've added whitelist)
Comments
Post a Comment