Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8278283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:57:33+00:00 2026-06-08T08:57:33+00:00

I am trying to get a string from a text file. I have a

  • 0

I am trying to get a string from a text file. I have a php file called genjsonGPS.php that looks like this:

<?php

$myFile = "vesselGPS.txt";
$fh = fopen($myFile, 'r');
$vesselGPS = fread($fh, filesize($myFile));
fclose($fh);

echo("Hello");


?>

When I run it, I get for an output in my browser:

“Hello”

I have a webpage with a js file using microAjax (from the js file):

microAjax("genjsonGPS.php", function (res) {
  alert (res);
});

When I run the webpage I get a blank alert. When I change the function above to:

microAjax("genjsonGPS.php", function (res) {
  alert (res.toString);
});

I get an alert that says:
function toString() { [native code] }

How do I get the function above to output “Hello” in the alert like the browser does?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:57:34+00:00Added an answer on June 8, 2026 at 8:57 am

    Please follow these tips.

    • Monitor your HTTP server’s access log, something like tail -f /var/log/apache/access.log is helpful. (Assume you are working on *nix platform)

    • If you are using Chrome, please check out the network monitor panel.

    You’d better make sure that:

    • Your php page is truly accessed.
    • There is no error occurs, both in server and client sides.

    If you still cannot figure out where things goes wrong, if would be useful to let people know how microAjax is implemented.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get all the text from a txt file into a string,
I am trying to tokenize my data that I get from my text file.
I'm trying to get a json string back from my controller, that is prefill-values
I'm trying to just get rid of duplicate consecutive words from a text file,
I have a text file that I am pulling from my SD card which
I'm trying to get data from a webpage that serves a XML file periodically
I have a php file that reads in information from a txt file and
I'm trying to get a std::string from my database using mysql connexion Here is
I'm trying to get the query string from a string (not the current URL).
I am trying to get a date object from a string from an input.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.