AJAX-Obtenha dados do php

Eu sou um novato no AJAX. A tarefa é obter os dados de um arquivo php e armazená-los em uma variável javascript. Passei por muitos exemplos, mas não achei útil. Estou dando um código pseudo-html aqui:

<html>
<head>
<script>
function ajaxfunction()
{
   //code for httprequest
   **call the php file declare a variable and store the response of php**
   //return the variable
}
</script>
</head>
<body>
   //my code for displaying a map
    **mainvariable=ajaxfunction();//storing the value of subvariable(data from php) in mainvariable**
   //use the mainvariable and do the remaining task
<body>

Meu código php:

<?php 
  $file=fopen("datapoints.txt","r");
  $read=fread($file,filesize("datapoints.txt"));
  fclose($file); 
  echo $read;
?>

o problema aqui é que eu não tenho nenhuma variável de formulário no meu arquivo html para usar ao chamar o arquivo php. simplesmente quando a página carrega, "ajaxfunction ()" deve ser chamado e obter dados do php e armazenar em uma variável ................

Acho que você pode entender meu problema

Qualquer ajuda é muito apreciad

questionAnswers(3)

yourAnswerToTheQuestion