The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic refresh
#1
I hate to ask this here because it feels like general web development but I'm stumped;

I have a page that has a set of categories on it that display a list of items from a db which each category held in a div being generated from a for loop.

http://hastebin.com/vezeluyigi.xml

http://hastebin.com/duyavanuvo.xml
on line 140 there is a script that effectively does what I need, but when i put the

` <script>
jQuery().ready(function(){
setInterval("getResult()",1000);
});
function getResult(){
jQuery.post("_category.php?Key=<?php echo $eventKey ?>",function( data ) {
jQuery("#cat<?php echo $catValue ?>").html(data);

});
}
</script>'

in the forloop it doesn't seem to work.

Im making a supplies list that automatically updates every few seconds to show when a user when another user has grabbed the supply needed.

When I hard code the redirects in the jQuery script it works but I can't differentiate the catergories.



Do you guys have any ideas on how I might solve this problem.
  Reply
#2
One tip, that may help with compactness and readability...any place that you have <?php echo.... ?>, you can replace it with <?=$blah?> . The short tag is used throughout the UserSpice code, so you should be safe using it if UserSpice is working fine.

What is it you want embedded in the for loop? You would like to use a PHP for loop to create those script blocks? Maybe a bit of clarification on what you are trying to do would help.
  Reply
#3
So I'm trying to make a list of required items for a event. I was hoping to make a single web page with drop down categories(equipment,bar,food,etc). I wanted to have the categories be dynamically loaded from the database, and then automatically refresh and keep the same category open and possibly return to the same line.

I used _category to make a webpage that took the event ID and Category being supplied and show the required items and refresh its self at short interval.

I was really tired when I wrote the first post! Guess I forgot to ask a question.

  Reply
#4
Rather than a page refresh, what about using jQuery directly to update the page as selections are made? It can definitely take a bit to make it work and still have it readable (I still have a lot of difficulty with jQuery), but I have usually been able to find chunks online which are close enough to what I want to do, that I can take it the rest of the way.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)