jQuery get values when use load for call other page

30 Views Asked by At

I use jQuery load for call one script and this script works perfectly, buy i want get response when use load inside this function, i put my example :

<script>
function insert(id)
{
jQuery("#loader").load("edit.php?insert=ok&id="+id+"");
}
</script>

This script call to edit.php for insert informations in a simple text document, the case it´s this script return some values and i want get this values, i put the php script :

edit.php

<?php

if($_REQUEST['insert']=="ok")
{
if(file_exists("img/".$_REQUEST['id'].""))
{
$result="fail";
}
else
{
fopen("img/".substr($_REQUEST['id'],0,-4).txt."","a");
$result="ok"
}

?>

The case it´s how i can get value from $result inside function insert(id), because i want get this value inside function for running other things and it´s important for me get inside this function when load and call to this script edit.php, i see some examples but don´t works for me.

Thank´s in advance for the help, best regards

0

There are 0 best solutions below