Cant AJAX be replaced by php or any other server-side language? I mean not replaced replaced...

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?

Other urls found in this thread:

destroyallsoftware.com/talks/the-birth-and-death-of-javascript
developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
adaptivepath.org/ideas/ajax-new-approach-web-applications/
tools.ietf.org/html/rfc6455
twitter.com/AnonBabble

no bully pls

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

Ohh php cant load parts of webpage without reload whole page even tho after reload only part of it is changed?

this
if your whole page takes more than 300ms to load and display on an average connection, you're doing something wrong anyway.

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.

AJAX refers to client-side (javascript, in-browser) calls to get data from servers

PHP is a server-side language

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

Huh? No.
You can use iframes if you want, but those suck.

>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.

>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

>If you want to replace Ajax, you need to replace Javascript
This is exactly what wasm hopes to accomplish.

I thought WebAssembly was javascript?

wasm is a bytecode language that you can supposedly compile anything to.

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)

and just like that - I love wasm now. How do I get started shilling this?

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.

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?

Because PHP is just a preprocessor. It generates a web page, and then sends it.
That's the limitation of all serverside scripting languages.

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

Thank you anons, thank you

AJAX is just the jQuery term for an XHR request

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

XML Http Request request

>AJAX is just the jQuery term for an XHR request
the term was coined before jQuery
adaptivepath.org/ideas/ajax-new-approach-web-applications/

>fucking n00bs
are you 12 years old?

>AJAX predates jQuery
>AJAX is just the jQuery term for an XHR request

what did he mean by this?

>AJAX is just the jQuery term for an XHR request
>Asynchronous Javascript and XML
>jQuery term
you wot

can't tell if bait

tools.ietf.org/html/rfc6455

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

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.

this is all i ever needed, thank you for great explanation anons, really appreciate your time