Ajax for DB Updation [closed] - php

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 8 years ago.
Improve this question
I am updating 100,000 records. So the page looks blank while the update query process runs on the backend. Can someone tell me how to display the text "Please wait blah blah" until the update ends?

Well depending on your script and the structure, the easiest way would be to change a div's css property called display. When a user clicks on a link that starts the php script, you could add a javascript code like :
$(#+THEIDOFYOURDIV).show("slow");
});
and once its done, you can call another js function to close it like :
$(#+THEIDOFYOURDIV).hide("slow");
});
*NOTE I am using jquery functions, so you would need to include jquery in your pages.
There is another way you could do this using php ONLY, I had the same issue so take a look at this: how to show results while a php script is still running

Related

Scraping data which loaded after scrolling to bottom [closed]

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'm working with PHP and I want to scrape some data from any website. But I have a problem. I scrape data but these items number are 48. But I know that page has 11K items. Rest of datas extend when you scroll and you get new bunch of datas (48 items).
I'm scraping with simple_html_dom. How can I manipulate scroll and get data ?
Thanks! :)
Sounds like the missing data is loaded via ajax.
Check the Network tab in the Developer Console (by pressing F12). Take a look at the URL which is being called (and the response), and edit it to your needs. Then call this URL instead of the one you are taking now.
It is impossible by this way.
But if you need to scrap this data you can send requests to endpoints which return lazily loaded data. You must research js code of target site.
p.s.
If you want to use really hard approach, you can research browser emulating.

Extracting data from a website after a delayed time with PHP [closed]

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

PHP dynamic page variable passing without submit button [closed]

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 9 years ago.
Improve this question
I have a MySQL query which will return a module code from the database. Let's say I have a template file (i.e. course.php) and what I would like to achieve is that I want to create a dynamic page with the name of the module code returned by the query (i.e. course.php?course=CS1231). However I don't have a submit button in course.php which allows me to pass that variable using GET method into URL. How can I achieve that?
AFAIK you don't need a submit button to use $_GET if your URL looks like this course.php?course=CS1231
You can just redirect to the page e.g.
<?php
$variable='course.php?course=CS1231'; #Whatever is returned by your database
header('Location: http://www.example.com/'.$variable);
exit;
?>
And in course.php you use $_GET['course'].

Passing form entries to query a database passed and updated to a div tag using AJAX [closed]

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 8 years ago.
Improve this question
I'm trying to create a page with an AJAX style form. Where on submit, the values in the form search and query a database and output the search results into the same DIV as the form was.
Any help would be much appreciated.
Thanks
jQuery is probably what you're looking for...
The docs are straightforward. http://jquery.com/
Generally, jQuery follows the find something then do something approach.
Find something ---> watch for some action on some element (in your
case, clicking submit)
Do something ---> make an ajax call to the php page you want to run
the query and return the results then insert the results where you
want on the page
http://api.jquery.com/jQuery.post/
Some other helpful jQuery commands for this task could be...
http://api.jquery.com/appendTo/
http://api.jquery.com/remove/
http://api.jquery.com/append/
Hope this helps.

How can users post after posts of others? [closed]

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 8 years ago.
Improve this question
I want to display an add comment button(like in here or FaceBook) for all of the users' posts.
As you can see in here, if you click "add comment" button, small input box opens and your comment appears right below where you add it with smaller size than normal posts.
I am confused about which language would be the best for this. I know a little about JavaScript and jquery but i think doing it with php is not possible. An idea or example to do that would be greatly helpful.
JavaScript shows the form field, than makes an Ajax call to the server when the person clicks the add content button.
The server saves the content to the database, and returns a success message.
If successful, the JavaScript shows the comment and hides the form fields.
JavaScript and jquery its a client side technologies. Php is a server side. You need a proper database design and can choose any sever technology you like.

Categories