Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to update a division of my webpage updated frequently. But the contents of the division is to be loaded from another file on the server which is unable to be accessed from the file. I have made the access for the first time through PHP on the server. When I'm updating the information, the javascript is on client-side and I'm unable to access it.Also, the meta tag refreshes the entire webpage. I just want to update the division
What are the ways to solve this problem?
You could do this with jQuery and AJAX
like this:
$.get('/route/to/file', { args }, function(data) {
$('#some-container').html(data);
});
If you need it to be fully realtime, you could also use Socket.io:
var ws = io( ... );
ws.on('some.realtime.event', function(data) {
$('#some-container').html(data);
});
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Cant seem to connect the ajax url to a php file. I've been fiddling around for ages.
File path of JavaScript: h******ze.com/public_html/wp-content/themes/buddyboss-theme-child/assets/js
needs to be be linked to file path PHP:
h******ze.com/public_html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php
setInterval(function(){
$.ajax({
url: '/public_html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php',
success: function(data) {
$('.result').html(data);
}
});
}, 3000);
Assuming the website is visible at h???????ze.com and not h??????ze.com/public_html your URL should be /wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/user-duration.php
public_html is the root of your website and will contain index.php so you need to point it there. The browser has no access to anything before this in the URL you are using.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need to give client to a print a receipt through my website directly. I know we can not do it via php because it is a serverside language. I have tried do it by using WebClientPrint.php. But I was unable to implement it. I need to know is it possible to implement such option in CodeIgniter
You need to use js for printing:
var w = window.open('files/invoices/invoice.html','name','width=800,height=500');
w.onload = w.print;
w.focus();
If you need to generate the file then use ajax to do that & then use the file path to print using above js functions.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a page web post which contains comments, everything works very well with the implement infinite page scroll, except that the pages loaded dynamically the comment part does not work side jquery!!!
Use jquery $(document).on() like this
$(document).on(event, selector, function(){
//implementation
});
That should do the trick for you.
Jquery does not sees DOM objects loaded after document ready automatically
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to extract prices from Klipsch.com but the prices don't immediately load upon loading the site, they load after the website is fully loaded using JavaScript or some other script. For example, I'm trying to extract the price from the inside of this page from the inside of this element:
<span class="product-display-price ecommerce-element">$3,284.00</span>
I've tried using Simple HTML DOM Parser but there is no delay function. I would like to achieve this in PHP but languages like Ajax would work fine too.
The site loads item details from an external javascript file. Why don't you call that file instead?
http://product.shopatron.com/product/{product_id}.jsonp?apikey={your_api_key}&...
For example, http://www.klipsch.com/products/la-scala-ii-floorstanding-speaker calls:
http://product.shopatron.com/product/1000996.jsonp?api_key=5gsk5uyr&apiVer=2.4.4&jstVer=2.4.4&method=get&headers%5BAccept%5D=*%2F*&callback=jQuery17202970524297561483_1481065390010&_=1481065390234
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a PHP page that retrieves a list from the DB, and I want to display it on a loaded page using Ajax.
Should I format it on the PHP side (HTML formatting), and just retrieve the data, or pass it to JS like dataA:dataB:dataC and format it client-side?
there won't be a lot of people using it, but I would like to know which is better (if there is a better method without taking the amount of users into account)
Both will work fine. However in my opinion if you're gonna use ajax - and transfer information - a better practice will be to wrap the data in JSON format and parse it on the client's machine.
Example of the php output:
{
"row1":{"field1":"value11", "field2":"value12"}
"row2":{"field2":"value21", "field2":"value22"}
...
}
Exmaple of parsing:
$.ajax(...).done(function(result){
$.each(result, function(index,value){
$('#conatiner').append('<div>'+index+': field1='+value.field1+', field2='+value.field2+'</div>')
})
});