[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Cant AJAX be replaced by php or any other server-side language?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 33
Thread images: 2

File: ajx.jpg (8KB, 318x158px)
ajx.jpg
8KB, 318x158px
Cant AJAX be replaced by php or any other server-side language? I mean not replaced replaced, I know they are not same thing , but I mean about actual result and functionality.

Cant php(or any other language) load parts of webpage just like ajax?
>>
no bully pls
>>
>>60642634
the only way that works is when ajax should not be used in the first place: when the needed data is available at page load time

ajax is for loading things at an undefined moment in time, before which said data can change
>>
>>60642826
Ohh php cant load parts of webpage without reload whole page even tho after reload only part of it is changed?
>>
>>60642826
this
>>60642885
if your whole page takes more than 300ms to load and display on an average connection, you're doing something wrong anyway.
>>
>>60642575
what? it's already what most people do. if you dont want js and a data protocol you can set meta refresh like in good ol days.
>>
>>60642575
AJAX refers to client-side (javascript, in-browser) calls to get data from servers

PHP is a server-side language
>>
>>60642575
PHP and AJAX aren't mutually exclusive. The data you're fetching with AJAX has to be generated using a server-side programming language like PHP.
>>
oh this again

"It's perfectly fine to refresh the entire page every time I make a little change because my time is worthless therefore everyone else's is"

the people who make web standards are so clueless, it's us to up hippie losers to keep it shitty and 90s paradigms, they were whatever shit we came up with first which is always the best.

please fuck off
>>
>>60642575
Huh? No.
You can use iframes if you want, but those suck.
>>
>>60642575
>Cant php(or any other language) load parts of webpage just like ajax?
No because that is an action on the client-side, i.e. the client must send info to the server and/or retrieve info from the server, and I don't know of any clients (web browsers) that support PHP scripting like they do Javascript.
>>
>>60642575
>Cant php(or any other language) load parts of webpage just like ajax?
Here lies the problem

Browsers use HTML, CSS and Javascript to display webpages. Hence the necessity of Ajax. If you want to replace Ajax, you need to replace Javascript or HTML/CSS. Then ask Browsers to support the new way of displaying the webpage(which is work they'll have to do, and have to keep on doing). You need to convince Firefox and Chrome to support your new method, as well as developers to code your method.

Thanks to Javascript - we got a lot of artfags that want to be coders, who refuse to learn anything other than Javascript (see Electron and NodeJS). Goodluck getting them to use another language.
protip: We already tried saying javascript is inefficient and is a horrible language.

It's Netscape's last FU to the tech industry
>>
>>60643063

>If you want to replace Ajax, you need to replace Javascript
This is exactly what wasm hopes to accomplish.
>>
>>60643104
I thought WebAssembly was javascript?
>>
>>60643153

wasm is a bytecode language that you can supposedly compile anything to.
>>
>>60643153
It's pretty much treated like pre-compiled JavaScript.
And currently, it can't do side-effects (Affect the DOM, do XHRs, access files or whatever)
>>
>>60643182
>>60643198
and just like that - I love wasm now. How do I get started shilling this?
>>
>>60643153
You may be thinking of asm.js which kind of led to wasm. asm.js is a subset of efficient Javascript (efficient to execute that is, while being painful for a human to write) that another language could be compiled to (see emscripten).

wasm takes that idea further, instead of just bootstrapping on top of Javascript it creates its own WebAssembly.
>>
>>60643231
https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript

Here's a humorous but interesting look at asm.js, and besides the direct relationship to Javascript the ideas still apply to wasm.
>>
Wait a second, why doesnt php has the power to update parts of webpage without refreshing the whole thing? Why is this not a thing?

Is it really impossible and thats why Ajax was invented?
>>
>>60643369

Because PHP is just a preprocessor. It generates a web page, and then sends it.
That's the limitation of all serverside scripting languages.
>>
>>60643369
php is a server-side language. when you go to a website powered by php, php renders the page and hands it over to the browser

dynamic updating is done by the browser itself. the browser runs javascript, not php
>>
>>60643390
>>60643399
Thank you anons, thank you
>>
File: Image.png (35KB, 581x365px) Image search: [Google]
Image.png
35KB, 581x365px
>>60642575
AJAX is just the jQuery term for an XHR request

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

XHR stands for "XML Http Request"

Meaning that it is a HTTP request, and in order to get a live reload from a browser, that browser must be making the XML Http Request, not the server.


fucking n00bs
>>
>>60644219
XML Http Request request
>>
>>60644219
>AJAX is just the jQuery term for an XHR request
the term was coined before jQuery
http://adaptivepath.org/ideas/ajax-new-approach-web-applications/

>fucking n00bs
are you 12 years old?
>>
>>60644219
>AJAX predates jQuery
>AJAX is just the jQuery term for an XHR request

what did he mean by this?
>>
>>60644219
>AJAX is just the jQuery term for an XHR request
>Asynchronous Javascript and XML
>jQuery term
you wot
>>
>>60644219
can't tell if bait
>>
https://tools.ietf.org/html/rfc6455
>>
>>60642885
I'm not sure I completely understand what you're saying, but the jist of it is: if you want to get new information without reloading the page, you can't use php.

This is important because it a. doesn't interrupt user experience and b. you only load the new stuff you need, not the entire page again
>>
>>60642885
It can't because of a very basic principle about how the web works.

The browser makes a request. The server processes the request, and then sends a response back to the browser, which then does something with it. When it comes to PHP, the browser sends a request, PHP processes it, and assuming we want a webpage, PHP returns a webpage which is then rendered by the browser. There is no other way it can work.

If we want to reload parts of a webpage without refreshing the entire webpage, and assuming we want data from the server, we need to make an asynchronous call. The browser must still send a request, but the only way it can actually send a request without refreshing is with Javascript because that is the only way we can make webpages behave dynamically without refreshing. And the only way a JS script can interact with the server is with an AJAX request: the browser asks JS to send a request, JS sends the request, PHP processes it, and it returns a response which is caught by the script. Finally, the script does something with the data.

That, more or less, is why we need AJAX.
>>
>>60645837
>>60647295
this is all i ever needed, thank you for great explanation anons, really appreciate your time
Thread posts: 33
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.