samedi 31 janvier 2015

Javascript GET not working how do i do it


Vote count:

0




So am trying to do this html code with javascript and php but its not working...


I checked the network tab via firefox i don't see the php code getting through can someone please tell me how i can do this?


I have been trying to do it since yesterday never got it working


Thanks alot



<?php
/**
* Created by PhpStorm.
* User: Joker
* Date: 1/29/2015
* Time: 11:50 PM
*/

ob_implicit_flush(true);
ob_end_flush();
ini_set('max_execution_time', 0);

$start_range = stripslashes($_GET['start_range']);

if (isset($_GET['start_range'])) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/charview.asp?temp={$start_range}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
preg_match('/<title>(.*)<\/title>/siU', $result, $titleMatches);
$title = preg_replace('/\s+/', ' ', $titleMatches[1]);
$title = trim($title);

if (strcmp($title, 'Object moved')) {
echo $title, '</br>';
}
}


?>

<body>
<div style="text-align: center;">
<form>
<input type="text" id="start_range"></br>
<input type="text" id="end_range"></br>
<button onclick="grab_users()">Grab Test</button>
</form>
</div>

<script>
function grab_users() {
var response = '';

var start_id = document.getElementById('start_range');
start_id = start_id.value;
alert(start_id)

$.ajax({ type: "GET",
url: "php/extract.php",
data: {'start_range': start_id},
success : function(text)
{
response = text;
}
});
alert(response);
}
</script>

</body>


asked 1 min ago







Javascript GET not working how do i do it

Aucun commentaire:

Enregistrer un commentaire