Jump to content

jQuery ajax request to a JS file


Omirion

Recommended Posts

Hy guys,

When i am making an ajax request to JS file what jQuery method should i use to get the return value of that script rather that the entire script itself.

 

A little clarification.

The returned information from the JS script will be in JSON.

I also need a way to send some data to the JS file. (string or another JSON object)

Then the js script will make some things internally and return data accordingly.

I also need to be able to set a callback function so i can make use of the returned data.

 

Is there a way to do this , or am i not understanding the way JS files work in general...

 

Will this be done more easily in PHP?

Link to comment
https://forums.phpfreaks.com/topic/225268-jquery-ajax-request-to-a-js-file/
Share on other sites

No the JS file file will not make another request to the server.

 

I'm using the JS file to store some information.

And can potentially get a bit large.

So i thought that i could make it into a script that returns only the information that is requested.

I decided to go with JS cause JSON is a bitch to work with in PHP... as i remember...

 

Maybe i can lazy load it?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.