S
S
Sergey2018-11-08 21:50:01
HTML
Sergey, 2018-11-08 21:50:01

Ajax request for html page?

Good afternoon!
I can't figure it out with ajax. Here is the script. There is a site with goods. You need to click the "show more" button to add new products. As far as I understand, if I install a local server on my PC, I can only receive moreAps.html from my PC. What if I need to show the site on another PC from github. Where should I store the moreAps.html file then?

Is the request correct? And can I do without PHP here?

$('.main-page__button').on('click', function(){
$.ajax({
url: 'moreAps.html',
cache: false,
method: 'get',
type: 'html',
success : function(html){
$('.appartments').html(html);
}
});
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Chuprik, 2018-11-08
@DaveGarrow

1. In order to show "on another PC", it is obvious that the file must be available from the Internet on some web server. Make your own server that looks at the Internet, or use hosting.
2. PHP is not required if you are requesting static pre-built files. To get dynamic content, a script must run on the server. It can be in any language, it can be PHP, Perl, Node.js, Python, etc. etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question