detener ajax cuando llega a una parte específica de la página?

is it possible to have the ajax run until it will read something, for example <!--end-->, how do i do that?

I want to call a page, and stop reading the page when it gets to the - i only need to read the content of the HEAD

preguntado el 08 de enero de 11 a las 16:01

That question doesn't make any sense, you should say what you want to do more clearly. -

Not really - do you want to perform a request and then do something with the result? Why can't you get the whole page and cut the stuff you want after? -

some of the pages are very long... and then it will take time to wait for the entire page to load when i only need the head -

1 Respuestas

Assuming you have nothing against php, there is a mean to do it.

Instead of calling for your file, call for a php script, which will parse your file until it meats your marker, in your case <!--end-->. Let's name it parser.php.

<?php

//Retrieve your file. It can be any type of plain text file which doesn't need
//to be interpreted, even html.
$lines = file("yourfile.txt");
$i = 0;
while(trim($lines[$i])!=="<!--end-->"){
    echo $lines[$i];
}

?>

Respondido el 09 de Septiembre de 11 a las 16:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.