PHP - Loop Ajax Call With Data Returned From Previous Ajax Call
Hello,
I've been trying this for hours now, looking at different examples and trying to change them to work for me, but with no luck... This is what I am trying to do: I have a simple form with: - 1 input field, where I can enter a number - 1 Submit Button When I enter a number into the field and click submit, I want that number to be send to the php file that is in the ajax call, then the script will take that number and run a bunch of queries and then return a new number. I want that new number to be used to call the php script via ajax again, until no number is returned, or something else is returned like the word "done" or something like that, at which point is simply makes an alert or populated a div with a message... The point is, that depending on the number entered it could take up to an hour to complete ALL the queries, so I want the script that is called to only run a fixed amount of queries at a time and then return the number it is currently at (+1), so that it can continue with the next number when it is called again. I would like to use jquery, but could also be any other way, as long as I get this to work. I already have the php script completed that needs to be called by the ajax, it returns a single number when being called. Thank you, vb Similar TutorialsPlease help me in this guys....... I am using MVC model for my application . I am stuck with the ajax call. this is my controller application/controller/admin/index.php function getCity() { $city=$this->model->getCity(); foreach($this->city as $key => $value) { echo '<option>'.$value['name'].'</option>' ; } } this is my model application/model/admin_model.php public function getCity() { if($_POST['id']) { $cid=$_POST['id']; $sth = $this->db->prepare('SELECT id, name FROM unit WHERE cid= :cid'); $sth->execute(array(':cid' => $cid)); return $sth->fetchAll(); } } this is my view <form id="city" action="<../application/admin/regstr/" method="post"> Country <select name="country" class="country"> <option value="" selected="selected">--Select Taluka--</option> <option value="1">India</option> <option value="2">USA</option> <option value="3">China</option> </select> City <select name="city" class="city"> <option selected="selected">--Select City--</option> </select> <input type="submit" /> </form> and this is my javascript for Ajax $(document).ready(function() { $(".country").change(function() { var id=$(this).val(); var dataString = 'id='+ id; $.ajax ({ type: "POST", url: "admin/getCity", data: dataString, cache: false, success: function(html) { $(".city").html(html); } }); }); }); But I am not getting the output. I have tested it with firebug in response tab. Instead of getting only option values html code as output I am getting the whole HTML page content (i.e. content of view page admin/index.php. Please help me out. Hi
I have an AJAX call that populates a select menu based on the selection from a previous menu. All works on on desktop browser, Safari, Firefox IE etc, however when using iOS the second select menu isn't populating.
the AJAX request is as follows
<script> function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getTeam(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('away-team').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } function getGP(strURL) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('gp').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } </script>and the trigger for it... <select name="year" class="txtfield" onChange="getGP('find_gp_ajax.php?season='+this.value)">Any ideas why the call won't work on iOS? Hello guys is it possible to create a single php file to contain all the functions to be called via AJAX and get AJAX to call the specific function required rather than having to create individual pages for each AJAX request you need to make? Many Thanks Hey guys, I'm making an Ajax call to my database and retrieving a newsletters HTML code as the result. I then prepend it into a div area called code_content. I use some php str_replace to add some links also. When the content loads into the div, the user can then add further content to it via Ajax calls, appending articles and that. What I'm trying to figure out is how can I then retrieve all the newly edited contents of this code_content div soni can send it to my Ajax function to write to te db? Can anyone figure out why this works in IE and Firefox but not Safari? Any help would be great. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Concept Builders</title> <link href="_css/main.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="_css/megamenu.css" type="text/css" media="screen" /> <script src="_scripts/pagebuilder.js" type="text/javascript"></script> <script src="_scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script src="_scripts/jquery.nivo.slider.pack.js" type="text/javascript"></script> <script src="_scripts/jquery.easing.1.3.js" type="text/javascript"></script> <script src="js/megamenu.js" type="text/javascript"></script> <?php include 'dbconfig.php'; include 'dbopen.php'; $plan=$_GET["plan"]; $sql = "SELECT * FROM homes WHERE plan_id= '".$plan."'"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $price=$row['price']; $sqft=$row['sqft']; $beds=$row['bedrooms']; $baths=$row['baths']; $amenities=$row['amenity_1'].", ".$row['amenity_2']; } setlocale(LC_MONETARY, 'en_US'); $price=money_format('%(#6.0n', $price); $plan_details= "<table> <tr> <td width='182' class='propDetailsHeadings'>Price:</td> <td width='75'>".$price."</td> </tr> <tr> <td class='propDetailsHeadings'>SQ Feet:</td> <td>".$sqft."</td> </tr> <tr> <td class='propDetailsHeadings'>Amenities:</td> <td></td> </tr> <tr> <td>".$amenities."</td> <td></td> </tr> </table>";?> <script language="javascript" type="text/javascript"> function loadPage() { var ajaxDisplay = document.getElementById("plan_details"); ajaxDisplay.innerHTML = <?PHP echo $plan_details;?>; } </script> </head> <body onload="loadPage()"> This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=334644.0 Hi, This is my first post in this forum and am a PHP beginner. I have written a script in php and need to use echo to see the values of variables etc. However I dont get the output on the screen while using echo . I am using Xampp server with Apache. The startup.html file code is
<!DOCTYPE HTML>
</head>
and the test.php code is <?php
$lat = $_REQUEST['latitude'];
echo 'latitude- '.$lat . ', longitude- ' . $lon; Please help regards
Sanjish This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=357605.0 I have a page that functions like this:
The user begins by loading ajaxtest.php, then using a drop-down menu, selects a user, after which a DIV on ajaxtest.php is populated with the user's selction to getuser.php?q=John%Doe
Here's a visual representation of what is currently happening, along with the part I don't understand.
getuser.php consists largely of a a large HTML table which interacts through PHP with my SQL database. Several of the fields in this table are editable, and after the user changes one of these fields, he can press an "update" button, which calls an AJAX script in update.js and runs update.php, which contains all my SQL queries to update the database, without the user being redirected to this update.php page. All of this is processing perfectly - the user makes some sort of edit, hits "update", and the database gets updated without any redirection or refresh.
Here's what I can't figure out though. Once the user makes a change, and hits "update," the database updates, but the end user doesn't see those changes that he made. I can't just do a simple page refresh, because the action is taking place on getuser.php, but getuser.php is loaded inside of a #DIV on ajaxtest.php. If I use something like window.location.reload(), this just refreshes ajaxtest.php and puts the user back to the starting point of having to select a user. This is not what I want. I don't want to refresh ajaxtest.php, I want to "refresh" ajaxtest.php with getuser.php?q=John%Doe insidethe DIV on ajaxtest.php.
It seems like this is very common - several forums have this capability, where a user has a page loaded, adds a comment, and sees that comment immediately without a full page refresh. I just don't know how to do it, and I've tried at lengths to search the web for an answer with no luck.
Can someone walk me through how to do this?
Where is my "Progr" return value?
This is not my first day using php but I don't code in the language that often. I don't understand why my dynamic variable is not returned in AJAX GET? Essentially, I need to give the client a simple UI so that they can copy files to a printer and I wanted to provide a little unfiltered feedback so they knew whether operation was a success. My feedback was just going to be output of exec() function though cleaned up slightly (perhaps replace line breaks with html break tags). PHP version is 5.2.17.17 and cannot be upgraded. Web Server Apache.
PHP dumbed down code:
exec("LoadZPL_PURL.bat", $output); Hello all I have a php and jquery/ajax call I am using to create a file/send an email. I get all the contents from my textboxes but I want a message to display on the screen afterwards being success or fail. In my .ajax call My call is exiting right before the ‘success:’ part. Why is my call not succeeding? Any tips/help will be appreciated Thank you Html page just a form with a submit button $(document).ready(function () { var form = $("#formData"); $(form).on("submit", function (event) { event.preventDefault(); $.ajax({ type: "post", url: "file.php", data: $(this).serialize(), beforeSend: function () { $("#status").html('<span style="color:red;">Loading everything actually creating a .TXT file of contents...</span>') //--works }, success: function (data) { var responseMsgType = "alert-" + data.type; var responseMsgText = data.message; // message below var alertBox = '<div class="alert ' + responseMsgType + ' alert-dismissable"><button type="button" class="close" ' + 'data-dismiss="alert" aria-hidden="true">×</button>' + responseMsgText + '</div>'; if (responseMsgType && responseMsgText) { $(form).find(".successArea").html(alertBox); $(form)[0].reset(); } } }); return false; }); <?php $controls = array('txtName' => 'Name', 'txtEmail' => 'Email', 'txtSubject' => 'Subject', 'txtMessage' => 'Message'); try { if(count($_POST)==0) { throw new \Exception ('Contact Form Message is empty'); } $headers = array('Content-Type: text/plain; charset="UTF-8";', 'From: ' . $email, 'Reply-To: ' . $email, 'Return-Path: ' .$email); $emailMessage = "You have a new message from your contact form" . PHP_EOL; $emailMessage .= "-------------------------------------------------------" . PHP_EOL; foreach($_POST as $key => $value){ if(isset($controls[$key])) { $emailMessage .= "$controls[$key]: $value". PHP_EOL; } } $mailMsg = "email6.txt"; if(file_exists($filename) == false) { $fh = fopen($mailMsg, "w"); fwrite($fh, $headers); fwrite($fh, $emailMessage); fclose($fh); } else { $fhexists = fopen($filename, "a"); fwrite($fhexists, $content); fclose($fhexists); } $responseMessage = array("type" => "success", "message" => $successMessage); } catch (\Exception $ex) { $responseMessage = array("type" => "errorM", "message" => $errorMessage); } if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $encodedJSON = json_encode($responseMessage); header("Content-Type: application/json"); echo $encodedJSON; } else { echo $responseMessage["message"]; }
Hello All, I have a PHP web application which will refresh itself(ajax calls connecting to the server and get the latest data) periodically. These also update the Database-based session handler class. i.e. There is NO UPDATE to the session data but the timestamp is constantly updated. Our problem is that garbage collection does not kick in as it looks at the difference between timestamp and session_gc.maxlifetime. So, if and the user is not interacting with the application. Now my question is how can I force the timeout even though refreshing happens but the user is not interacting with the application and there are "phantom" session updates made by these ajax calls. Please let me know. Thanks. Hello all,
I feel pretty good that I got my AJAX filter working properly. But it still needs some help. Now I am returning the content with Ajax that I want from the search filter of dropdown option (keep in mind there are several options to filter by). But the content returned is often to much to fit on one page - so I need to paginate the successfully returned html from my AJAX call.
Here is where I get stumped. Do I setup a normal page nav outside the AJAX area?
</div><!-- AJAX return container--> <nav class="pagenav"> <ul id="pag-link"> <li class="old"><?php next_posts_link('« Older Sermons', $sermons_query->max_num_pages) ?></li> <li class="new"><?php previous_posts_link('Newer Sermons »', $sermons_query->max_num_pages) ?></li> </ul> </nav>IF so, how do I update the links info? or do I keep the page nav inside the AJAX area but use some custom code to retrieve the proper link? (I tried using the normal wordpress page nav functions in my php function but they provide the url of the page that the php function is on, not the actual page being viewed). Do I need to make a separate AJAX call to a function that just builds my links? or is there a way to do it with my main call? Here is my AJAX call: //Listen for the menu's to change except the main filter_by dropdown var ids = ['filter_preacher_dropdown', 'filter_sort_by_dropdown', 'filter_per_page_dropdown', 'filter_series_dropdown', 'filter_service_dropdown', 'filter_tag_dropdown', 'filter_book_dropdown', 'filter_year_dropdown']; $('#' + ids.join(',#')).change(function(e) { var pt = [ "preacher","series","service" ]; if($.inArray(this.name, pt)!==-1){ var mk = this.name; var mv = $(this).val(); var ppp = $("#filter_per_page_dropdown").val(); var ob = $("#filter_sort_by_dropdown").val(); var data = { action: 'filter_sermons', meta_key: mk, meta_value: mv, posts_per_page: ppp }; $.post(mbsb_ajaxurl, data, function(response) { $('#sermonlists').fadeOut('slow', function() { $(this).html(response) }).fadeIn('slow'); }); }and here is my php function (slightly paired down for viewing ease): //ajax for sermons filter add_action('wp_ajax_filter_sermons', 'check_ajax'); add_action('wp_ajax_nopriv_filter_sermons', 'check_ajax'); function check_ajax() { global $wpdb, $paged, $max_num_pages; //check if filter is on post_type if($_POST['meta_key']){ $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $mk = '"'.$_POST['meta_key'].'"'; $mv = intval($_POST['meta_value']); $ppp = intval($_POST['posts_per_page']); $offset = ($paged - 1) * $ppp; $sermons = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS sermons.* FROM {$wpdb->prefix}posts AS sermons, {$wpdb->prefix}postmeta WHERE meta_key = {$mk} AND meta_value = {$mv} AND sermons.ID = {$wpdb->prefix}postmeta.post_id LIMIT {$offset}, {$ppp}", OBJECT); $sql_posts_total = $wpdb->get_var( "SELECT FOUND_ROWS();" ); $max_num_pages = ceil($sql_posts_total / $ppp); }elseif($_POST['name']){ //another custom query }elseif ($_POST['book_number']){ //another custom query } $posts = get_posts(); // returns posts in an array if($sermons) { global $post; foreach ($sermons as $post){ setup_postdata($post); //custom query info returned here } //Would the Pagination for the AJAXED content go here? }else{ ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php } die(); } This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=319682.0 OVERVIEW: The code is about making call to the escreen web service using SOAP and Curl with client authentication required. Currently I am not getting any result only HTTP 403 and 500 errors. The call requires client authenticate cert to be on the callng site. CODE: $content = "<TicketRequest> <Version>1.0</Version> <Mode>Test</Mode> <CommitAction></CommitAction> <PartnerInfo> <UserName>xxxxxxxxxx</UserName> <Password>xxxxxxxxxxx</Password> </ PartnerInfo> <RequestorOrderID></RequestorOrderID> <CustomerIdentification> <IPAddress></IPAddress> <ClientAccount>xxxxxxxxxx</ClientAccount> <ClientSubAccount>xxxxxxxxxx</ClientSubAccount> <InternalAccount></InternalAccount> <ElectronicClientID></ElectronicClientID> </CustomerIdentification> <TicketAction> <Type></Type> <Params> <Param> <ID>4646</ID> <Value></Value> </Param> </Params> </TicketAction> </TicketRequest>"; $wsdl = "https://services.escreen.com/SingleSignOnStage/SingleSignOn.asmx"; $headers = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", // "SOAPAction: \"\"", "Content-length: ".strlen($content), ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $wsdl); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $content); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1'); //curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //curl_setopt($ch, CURLOPT_HTTPHEADER, array('SOAPAction: ""')); curl_setopt($ch, CURLOPT_CAPATH, '/home/pps/'); curl_setopt($ch, CURLOPT_CAINFO, '/home/pps/authority.pem'); curl_setopt($ch, CURLOPT_SSLCERT, 'PROTPLUSSOL_SSO.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'xxxxxxxxxxxx'); $output = curl_exec($ch); // Check if any error occured if(curl_errno($ch)) { echo 'Error no : '.curl_errno($ch).' Curl error: ' . curl_error($ch); } print_r($output); QUESTIONS: 1. I need to call the RequestTicket method and pass the XML string to it. I don't know how to do it here(pass the method name to call). 2. For client authentication they gave us three certs, one root cert, one intermediate cert and a client authentication cert PROTPLUSSOL_SSOpem(it was a .pfx file). Since we are on linux we converted them to pem . In curl calls I could not find way to how to include both the root cert and the intermediate cert ,so I combined them by making a new pem file and copying the intermediate cert and them the root cert and naming it authority.pem . I am not sure whether it works or not and would like your opinion. 3. For the current code Iam getting the error Error no : 77 Curl error: error setting certificate verify locations: CAfile: /home/pps/authority.pem CApath: /home/pps/ If I disable the curl error message,I am getting blank page with page title 403 - Forbidden. Access is denied. If I comment out the CURLOPT_CAPATH and CURLOPT_CAINFO lines it gives http 500 error page with the message as content and the following at the top. > HTTP/1.1 500 Internal Server Error. Cache-Control: private Content-Type: text/html Server: Microsoft-IIS/7.5 X-AspNet-Version: 1.1.4322 X-Powered-By: ASP.NET Date: Thu, 02 Sep 2010 14:46:38 GMT Content-Length: 1208 If I comment out as above and also CURLOPT_SSLCERT and CURLOPT_SSLCERTPASSWD it gives 403 error with the message as content. So I would request you to help me out by pointing out whats wrong with the current code. Thank you. I can call the following function successfully as a single php program // Acknowledge and clear the orders function ack($client, $merchant, $id) { $docs = array('string' => $id); $params = array('merchant' => $merchant, 'documentIdentifierArray' => $docs); $result = $client->call('postDocumentDownloadAck', $params); return $result; } with $result = ack($t, $merchant,'2779540483'); successful output [documentDownloadAckProcessingStatus] => _SUCCESSFUL_ [documentID] => 2779540483 I'm trying to figure out how to call this function as an object from another program. Trying the following gives error ***Call to a member function call() on a non-object*** function postDocumentDownloadAck($t, $merchant, $id) { $this->error = null; $docs = array('string' => $this->id); $params = array('merchant' => $this->merchant, 'documentIdentifierArray' => $docs); ** I've tried the following which does nothing $result = $this->soap->call('postDocumentDownloadAck', $params); ** I've tried the following - which gives error "Call to a member function call() on a non-object" $result = $this->t->soap->call('postDocumentDownloadAck', $params); if($this->soap->fault) { $this->error = $result; return false; } return $result; } *** calling program snippet for above function $merchant= array( "merchant"=> $merchantid, "merchantName" => $merchantname, "email"=> $login, "password"=> $password); $t = new AmazonMerchantAPI($merchantid, $merchantname, $login, $password); $documentlist= $t->GetAllPendingDocumentInfo('_GET_ORDERS_DATA_'); $docid = $documentlist['MerchantDocumentInfo'][$i]['documentID']; $docs = array('string' => $docid); $ackorders = $t->postDocumentDownloadAck($t, $merchant,$docs); Any ideas of what I'm doing wrong are greatly appreciated. Hello, I am new to PHP and have come to a grinding halt in my project. I am attempting to dynamically generate values for Wordpress shortcodes ( [example] ). I have successfully created the shortcodes and am having trouble setting their value. When I call the function that is supposed to return the value for the shortcode, it returns empty. I can however hard code a string and have it returned to the function, thereby manually creating a value for the shortcode. However, because the shortcodes are being generated and filled dynamically, I need this function to work without specific values. I know this may sound like a Wordpress specific question, but I have a feeling it's just my lack of understanding of PHP operations. So, here is the basic layout: The name of the shortcode is generated from within a foreach loop that retrieves the name of custom fields on the post ($keyName). Code: [Select] $custom_field_keys = get_post_custom_keys(); foreach ( $custom_field_keys as $key => $keyName ) { $valuet = trim($keyName); if ( '_' == $valuet{0} ) continue; if ( get_post_meta($thePostID, $keyName, true) ) : $fieldName = get_post_meta($thePostID, $keyName, true); endif; $fieldValue = $_GET["$keyName"]; add_shortcode((string)$keyName, 'myFields'); } The add_shortcode function has two parameters ('name_of_shortcode', 'function_name'): Code: [Select] add_shortcode((string)$keyName, 'myFields'); I need the myFields function to return the value of $fieldValue from within the foreach loop. That's where the problem lies. This doesn't work: Code: [Select] function myFields() { $myString = preg_replace('/[^a-zA-Z\s]/', '', $fieldValue); return $myString; } This does work: Code: [Select] function myFields() { return 'Content to replace the shortcode'; } This code will replace [shortcode] with "Content to replace the shortcode" in the post. The ultimate goal is: when [$keyName] appears anywhere within the post, it will display the content returned by the myFields function ($fieldValue). However, it's not working. I can't seem to pass the value of $fieldValue to the myFields function and thereby return it to add_shortcode. Any help is appreciated and I am awaiting anxiously to answer any questions. Here's all the code together: Code: [Select] function myFields() { $myString = preg_replace('/[^a-zA-Z\s]/', '', $fieldValue); return $myString; } $custom_field_keys = get_post_custom_keys(); foreach ( $custom_field_keys as $key => $keyName ) { $valuet = trim($keyName); if ( '_' == $valuet{0} ) continue; if ( get_post_meta($thePostID, $keyName, true) ) : $fieldName = get_post_meta($thePostID, $keyName, true); endif; $fieldValue = $_GET["$keyName"]; add_shortcode((string)$keyName, 'yourFunction'); } Right now I redirect to index page after I delete a record. However I am looking to make it so that I can delete a record without redirecting the page. I know this can be accomplised using Ajax. I have spent countless hours before trying to make it work, but it did not work.
So here is a basic setup I created. Can you please update it with ajax code so that I can see how it's done properly?
<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>Home Page</title> </head> <body> <div class="record" > <a href="record.php?id=<?php echo $record_id ?>"><?php echo $record_name; ?></a> <div class="delete-record"> <a href="delete.php">Delete Record</a> </div> </div> </body> </html> Edited by man5, 18 August 2014 - 08:55 PM. hi every body.
i want a loop that takes and shows more than one record from database.
and then i want to show these to user by ajax.
indeed i made an html page that when user arrives at end it must do this.
first i made loop that took one record from database and it worked fine.
but for taking several records it went wrong.
this is my html file that has interact by user
webgoo-ajax.html 4.36KB
2 downloads
and this is my php file that interacts by database
ajax-get.php 1012bytes
3 downloads
when user arrives at end of page naturally ajax must be run and show several records to user.but it does'nt.
first it stays idle for 3 minutes and then loads my first record extremely.
and a point: if these pages does'nt work on IE it will work on Firefox because it did'nt worked in IE for me too.
i just want a for loop that work correctly for my need.
thank you for everything
I have trouble calling timepicker with class and passing data-values to the script.
So what i have so far is one loop that for each entry it will create foreach($data as $value){ $min_hour = $value['minhour']; // returns value from DB like 7 to 12 echo '<td><input type="text" value="" class="schedule-timepicker" data-minhour="'.$min_hour.'" data-minminutes="30" data-maxhour="17" data-maxminutes="00"></td>'; }Then in js file I have $(document).ready(function(){ $('.schedule-timepicker').timepicker({ timeFormat: 'HH:mm:ss', minDate: new Date(1, 1, 1, $('.schedule-timepicker').data('minhour'), 00), maxDate: new Date(1, 1, 1, $('.schedule-timepicker').data('maxhour'), 00), }); });Problem is that the timepicker is called out and works but every input has the same minimum hours value as the first one. Please help how to resolve this. Thanks. |