Jump to content

Search the Community

Showing results for tags 'ajax'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. mainpage.php, loginModal.php, signInvalidate.php I have a page has a button that when click a modal dialog box pop up, the content of the modal is from other page(loginModal.php) using jquery .load, so the content now of the modal is a login form which validates using jquery ajax that send information to signInvalidate.php. I have no problem on validation it still return error if it is error, but if it is correct information I want to reload the main page. How will I do that? or does Jquery .load accepting return TRUE value. e.g. signInvalidate.php $result = $userFunction->checkLogin($useremail, @$password, @$remember, $gotUrl); if($result == TRUE){ return TRUE; } loginModal.php success: function(msg){ if(msg == TRUE){ return true; }else{ $("#signInOutput").html(msg); } } mainpage.php $('#previewOutput').load('modalLogin.php', function(){ });
  2. I've got a modal dialog that pop up then load and show the loader image then after a seconds it will hide and preview the "modalLogin" page. $(href).fadeIn(100, function(){ $('#loadingImage').show(1,function(){ setTimeout( function(){ $('#loadingImage').hide(1, function(){ if(thisId == 'loginModal' ){ $('#previewOutput').load('modalLogin.php'); //alert("Login"); } } ); },500); }); }); At first loading the main page and clicking the button for modal dialog to pop up it is fine, but when I close the modal dialog and click the button for modal again, the loading is mess up! So can anyone explain to me what is wrong? Here's link : [LINK]
  3. I'm not sure if this is the right place for this, but since php is sort of the hub I figure this might work. I'm struggling with finding the right way to snag a variable from a javascript prompt and pass that through to the server for a mysql query. I'm relatively new to all of this, so any help (even the obvious stuff) would be greatly appreciated. Here's my situation... I'm using a scheduling plugin on Wordpress that allows users to schedule an appointment with a service provider. Unfortunately, these appointments are for a set duration (e.g. 30 minutes). I'd like to allow the user to select their start time and then set their own duration. The plugin uses jQuery to display a calendar in table format and the user can click on a date/time that works for them. Then a new <div> appears on the page to confirm the appointment. I would basically like to insert a javascript prompt when the user clicks on their starting time that asks for the duration in hours. I need to pass this value back to the server (using jQuery or Ajax I'm guessing?) so I can send a query to the database and check if this time conflicts with other appointments, then continue with the confirmation <div>. I've spent probably 2 or 3 hours searching Google and I'm simply not finding a way to do this. Seems like it should be straightforward, but the answer is eluding me.
  4. I'm new here and looking for help with a problem (already tried googling it, though I'm not sure I'm even explaining it correctly). The only file visible to the user is this <?php include "../../the-actual-site/index.php"; ?> The rest of the site is behind the "www" folder, and uses includes, get, and session, variables to navigate the pages. Now I want to add some javascript to the display pages, but some nasty things are happening when i do, i trimmed everything down to a bare example (just to make sure something else was not interfering), but these problems still persist. So for the example page I have setup the index.php in the www folder the same way, and used the page from this tutorial as a working example. The tutorial pages work fine if laid out as instructed, or renamed/moved around (but not included). So the first problem is that that the javascript requires me to expose the "index.php" part of the url to send a get variable. (I trued outputting just the "?var=" part, and it did not work) The production site never exposes this, and while I don't believe it would cause an issue, I would rather keeps things "as-is" than having people freak out over it. The second issues is that the javascript is making the page display twice once it starts working. Another instance of the page is created below the first one (the second is non-functional). So first, how can I use js in an include without the page duplicating? And second how do I get javascript to output clean GET variables without showing the "index.php" part?
  5. Hi all, I am working with a drop down to auto populate a textarea with preset fields / lines. The issue I keep having is the formatting to the text being populated has no lines/breaks to it. Below is the current java script snip it and the form as it stands. I am looking to find if there would be a better method to doing this, including creating a php form utlizing ajax to pull the information. Thoughts? Javascript: <script type="text/javascript">function updateTextBox(val) { if(val == "1") { document.forms['Form'].elements['TextBox'].value = "Line 1, Line 2, Line 3, Line 4";<--- In theory should display as entered, however this does not occur on any line break/Also /n/p/br/&nbsp do not work to adding lines/breaks. } else if(val == "2") { document.forms['Form'].elements['TextBox'].value = "Line 1 &nbsp Line 2"; } } </script> Form: <form name="Form"> <select onchange='updateTextBox(this.value)'> <option value=""></option> <option value="1">Test</option> <option value="2">Test2</option> </select> <tr> <td> <div align="left"><span id="copy"> <textarea name="TextBox" cols="29" rows="30" style="font-family: Verdana" class="size12"></textarea> <br /> </span></div> <table width="20%" border="0" align="left"> <tr><td><input name="Button" type="button" onclick="javascript:selectcopy('Form.textbox')" value="Copy Notes" /></td></tr> <tr><td><input name="RESET" type="RESET" value="Clear Notes" /></td></tr> </table> </div>
  6. i have a very basic ajax script. It works for if login is successful, but the not when the login is not ok. <script type="text/javascript"> // Wait for the page to load first window.onload = function() { function createObject() { var request_type; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_type = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); var a = document.getElementById("login"); //Set code to run when the link is clicked // by assigning a function to "onclick" a.onclick = function() { document.getElementById('login_response').innerHTML = "Loading..." var username = encodeURI(document.getElementById('username').value); var password = encodeURI(document.getElementById('password').value); nocache = Math.random(); http.open('get', 'http://appsmarketing.net/hr/login.php?username='+username+'&password='+password+'&nocache = '+nocache); http.onreadystatechange = loginReply; http.send(null); } function loginReply() { if(http.readyState == 4){ var response = http.responseText; if(response == 0){ document.getElementById('login_response').innerHTML = 'Login failed! Verify user and password'; // else if login is ok show a message: "Welcome + the user name". } else { document.getElementById('login_response').innerHTML = 'Welcome'+response; } } return false; } } </script> </head> <body> <form method="get"> <tbody> <tr> <td >Username: </td> <td ><input type="text" name="username" value="" id="username" class="txt_bg"></td> </tr> <tr> <td>Password: </td> <td ><input type="password" name="password" id="password" value="" class="txt_bg"></td> </tr> <tr> <input id="login" type="submit" value="Login" class="login_btn"></a></div> </tr> </tbody> </table> </form> and the php file is <?php if(isset($_GET['username']) && isset($_GET['password'])){ $uname = $_GET['username']; $psw = $_GET['password']; $aa="SELECT 'mid' FROM `check` WHERE uname='".$uname."' AND password123='".$psw."' AND mid='1'"; $query=mysql_query($aa) or die(mysql_error()); $num_results=mysql_num_rows($query) or die(mysql_error()); if(($query)&&($num_results==1)) {echo "ok done";} else {echo "0";} } ?> i want to make response==0, but the control transfers to the else part of javascript function?? how do i return the false value to get login failed message.. Thanks in advances...
  7. I am attempting to create an ajax contact form that the results gets emailed to me. I found a form demo online and edited it to meet my criteria, except that there were no checkboxes in the demo, when I add checkboxes everything but those work. Can someone please guide me through this? Here is the html <div class="done"> <strong>Thank you !</strong> We've received your questions and someone from our office will respond at our earliest convience.</p> <p>Check your email, we just sent you a coupon for 10% off your first purchase.</p> </div> <div class="form"> <form method="post" action="process2.php" autocomplete="off"> <label for="name">Name</label> <input type="text" name="name" id="name" /> <label for="phone">Phone</label> <input type="text" name="phone" id="phone" /> <label for="email">Email</label> <input type="text" name="email" id="email" /> <ul> <li>Design:</li> <li><label for="master_plan"><input type="checkbox" name="service[]" id="master_plan" value="Master Plan" /> Master Plan</label></li> <li><label for="front_foundation"><input type="checkbox" name="service[]" id="front_foundation" value="Front Foundation" /> Front Foundation</label></li> <li><label for="backyard_plan"><input type="checkbox" name="service[]" id="backyard_plan" value="Backyard Plan" /> Backyard Plan</label></li> <li><label for="specialty_garden"><input type="checkbox" name="service[]" id="specialty_garden" value="Specialty Garden" /> Specialty Garden</label></li> </ul> <label for="newsletter"><input type="checkbox" name="newsletter" id="newsletter" value="x" checked="checked" /> Yes, I would like to be added to your newsletter list.</label> <label for="comments">Comments</label> <textarea name="comments" id="comments" rows="5" cols="40" /></textarea> <input type="submit" id="submit" value="Sign Up" /> <div class="loading"></div> </form> </div> The java is <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#submit').click(function () { var name = $('input[name=name]'); var phone = $('input[name=phone]'); var email = $('input[name=email]'); var comments = $('textarea[name=comments]'); if (name.val()=='') { name.addClass('hightlight'); return false; } else name.removeClass('hightlight'); if (email.val()=='') { email.addClass('hightlight'); return false; } else email.removeClass('hightlight'); var data = 'name=' + name.val() + '&phone=' + phone.val() + '&email=' + email.val() + '&comments=' + encodeURIComponent(comments.val()); $('.text').attr('disabled','true'); $('.loading').show(); $.ajax({ url: "process2.php", type: "GET", data: data, cache: false, success: function (html) { if (html==1) { $('.form').fadeOut('slow'); $('.done').fadeIn('slow'); } else alert('Sorry, unexpected error. Please try again later.'); } }); return false; }); }); </script> And the php is $name = ($_GET['name']) ? $_GET['name'] : $_POST['name']; $phone = ($_GET['phone']) ?$_GET['phone'] : $_POST['phone']; $email = ($_GET['email']) ?$_GET['email'] : $_POST['email']; $mailing = ($_GET['newsletter']) ?$_GET['newsletter'] : $_POST['newsletter']; $comments = ($_GET['comments']) ?$_GET['comments'] : $_POST['comments']; if($phone) {$phone = '('.substr($phone, 0, 3).') '.substr($phone, 3, 3).'-'.substr($phone, 6, 4);} else {$phone = '(Not Entered)';} How do I add the checkbox values, ONLY if the box is checked? (I didn't add the email part, because all of that works except for the "services" part.) I'd like to have whatever services are checked to showup, seperated by a coma.
  8. I need ajax pagination script with edit and delete options. I have created one but when I delete a record it doesnot get updated where as when i add or edit record it gets updated.
  9. Hi All, I want to ask you about my calendar appointment. The problem in my calendar is when user A insert new agenda, user B must refresh it manually for can see the changes. I've used an auto div refresh which is refresh page automatically but it still didn't work. The problem is in my calendar have a nex and previous button to see the other months. When I'm access my calendar for first time, it works fine (user B don't need refresh it manually). But when I click the previous next button, user B must refresh it manually again. Can you show me where can I fix my code ? Here's the calendar file before spiltted into two parts. <?php include "connection.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Agenda</title> </head> <body> <?php $monthNames = Array("January","February","March","April","May","June","July","August","September","October","November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13 ) { $next_month = 1; $next_year = $cYear + 1; } ?> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a></td> </tr> </table> </td> </tr> </table> <tr> <td align="center"> <table width="100%" border="1" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { //echo "<a href=2.php>".$i."</a><br>"; if(($i % 7) == 0 ) { echo ""; } if($i < $startday) { echo "<td></td>\n"; }else { $sql = "select * from agenda where date='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'"; $hs = mysql_query($sql); $jmlAcara = mysql_num_rows($hs); echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">"; echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])." onclick=\"window.open(this.href,'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>"; echo "</td>\n"; } if(($i % 7) == 6 ) { echo "</tr>\n"; } } ?> The I split up the file into two parts.The first is index.php who will refresh the user.php file every 1000ms. <?php include "connection.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Agenda</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajaxSetup( { cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never setInterval(function() { $('#result').load('user.php'); }, 1000); // the "3000" here refers to the time to refresh the div. it is in milliseconds. }); </script> </head> <body> <?php $monthNames = Array("January","February","March","April","May","June","July","August","September","October","November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13) { $next_month = 1; $next_year = $cYear + 1; } ?> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"><a href="<?php echo "cal.php?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo "cal.php?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a></td> </tr> </table> </td> </tr> </table> <tr> <div id="result"> The second file is user.php which contains the calendar. <?php include "connection.php"; $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $month=$_GET["month"]; $year=$_GET["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13) { $next_month = 1; $next_year = $cYear + 1; } //$m=$_GET["month"]; //$y=$_GET["year"]; ?> <table width="100%" border="1" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { //echo "($maxday+$startday)"; //echo "<a href=2.php>".$i."</a><br>"; if(($i % 7) == 0 ) { echo ""; } if($i < $startday) { echo "<td></td>\n"; }else { $sql = "select * from agenda where date='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'"; $hs = mysql_query($sql); $jmlAcara = mysql_num_rows($hs); echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">"; echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])." onclick=\"window.open(this.href,'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>"; echo "</td>\n"; //echo "$cMonth"; } if(($i % 7) == 6 ) { echo "</tr>\n"; } } ?> Thank you.. Regards, Ikram
  10. I'm making an ajax query to allow my select box to parse a selected id to an ajax query using this code: <select name="top_cat<?php echo $r['product_id'];?>" id="top_cat<?php echo $r['product_id'];?>" onchange="javascript: MyAjaxRequest('sub_cat_selector<?php echo $r['product_id'];?>','sub_cat_selector.php?id='+top_cat<?php echo $r['product_id'];?>.value);"> It doesn't work and I think I may be making a very silly mistake. Any suggestions?
  11. I have a search results page, and when someone clicks on the next link, or a higher page number, I want the current results to slide out to the left, whilst the new ones slide in from the right. Then if someone clicks on previous or a lower page number I want the current results to slide out to the right, and the new ones to slide in from the left. Also if possible can it change the url when the new results come in? I want to use jquery, and was wondering what is the best way to do this, would it be using animate? I have tried but cant seem to work it out.
  12. I have the following ajax call which seems to work great in chrome. When I run it in IE (all versions) it fails. the link you click is <a href="javascript:void(0);" onclick="getImages(1)">Folder 1</a> This calls the ajax function below. Excuse if its messy its my first ever call <script type="text/javascript"> $.ajaxSetup ({ cache: false }); function getImages(id) { $.ajax({ type: "POST", url: 'getImage.php', data: "id=" + id, success: function(data) { $('#scrolimg').html(data); $("#car1").carouFredSel({ auto : false, items : 4, scroll : 4, circular : false, infinite : false, prev : "#foo1_prev", next : "#foo1_next", swipe : { onTouch : true, onMouse : false } }); } }); } the getImage.php <?php do { $image = $_SERVER['DOCUMENT_ROOT']."/images/uploads/".$row_rs_image['thumbfile']; list($width, $height)= getimagesize($image); ?> <img src="/images/uploads/<?php echo $row_rs_image['thumbfile']; ?>" width="<?php echo $width;?>" height="<?php echo $height;?>" /> <?php } while ($row_rs_image = mysql_fetch_assoc($rs_image)); ?> This images are only outputted if there is a width and height value. This is a must with the carousel the images are displayed in. Which is fine because in chrome it works. When It comes to IE though. If I record the ajax output I can see the error. For the image to be displayed it needs a width and height The image being outputted in IE is <img src"/images/uploads/img_thumb.jpg" width="" height="" /> The same image in chrome <img src"/images/uploads/img_thumb.jpg" width="150" height="160" />
  13. I'm trying to load a listbox named Doggie with this script. It's in the header of my webpage. Can anyone see what I am doing wrong? Thank you. switch(n){ case "Place": $(".Doggie").load(function() $.ajax({ type: "POST", url: "place_place.php", cache: false, success: function (html) { $(".Doggie").html(html); } }); }); break;
  14. Okay here is what I have in the works. What I want to achieve is the ability to update the order of items in a database upon change and if an item is moved from one tab to another it will update as well. <?php include ('global.php') ; ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>IT WHITEBOARD</title> <link rel="stylesheet" href="css/jquery-ui.css" /> <script src="jquery-1.8.3.js"></script> <script src="jquery-ui.js"></script> <style> #sortable1 li, #sortable2 li, #sortable3 li, #sortable4 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 100%; } </style> <script> $(function() { $( "#sortable1, #sortable2, #sortable3, #sortable4" ).sortable().disableSelection(); var $tabs = $( "#tabs" ).tabs(); var $tab_items = $( "ul:first li", $tabs ).droppable({ accept: ".connectedSortable li", hoverClass: "ui-state-hover", drop: function( event, ui ) { var $item = $( this ); var $list = $( $item.find( "a" ).attr( "href" ) ) .find( ".connectedSortable" ); ui.draggable.hide( "slow", function() { $tabs.tabs( "select", $tab_items.index( $item ) ); $( this ).appendTo( $list ).show( "slow" ); }); } }); }); </script> </head> <body> <div id="tabs"> <ul> <li><a href="#tabs-1">Emergency Tasks</a></li> <li><a href="#tabs-2">Priority Tasks</a></li> <li><a href="#tabs-3">Issues List</a></li> <li><a href="#tabs-4">Completed Tasks</a></li> </ul> <div id="tabs-1"> <ul id="sortable1" class="connectedSortable ui-helper-reset"> <?php // Database Connection mysql_connect("$dbhost","$dbuser","$dbpasswd") ; // Database Selection mysql_select_db("$dbname") ; // Validate Connection $result1 = mysql_query("SELECT * FROM tasks WHERE priority = 'Emergency' ORDER BY order_no ASC") ; while($row = mysql_fetch_array($result1)) { $job_name = $row['job_name'] ; echo '<li class="ui-state-default"><a href="/">'.$job_name.'</a></li>' ; } // Close Query mysql_close($result1) ; ?> </ul> </div> <div id="tabs-2"> <ul id="sortable2" class="connectedSortable ui-helper-reset"> <?php // Database Connection mysql_connect("$dbhost","$dbuser","$dbpasswd") ; // Database Selection mysql_select_db("$dbname") ; // Validate Connection $result2 = mysql_query("SELECT * FROM tasks WHERE priority = 'Priority' ORDER BY order_no ASC") ; while($row = mysql_fetch_array($result2)) { $job_name = $row['job_name'] ; echo '<li class="ui-state-default"><a href="/">'.$job_name.'</a></li>' ; } // Close Query mysql_close($result2) ; ?> </ul> </div> <div id="tabs-3"> <ul id="sortable3" class="connectedSortable ui-helper-reset"> <?php // Database Connection mysql_connect("$dbhost","$dbuser","$dbpasswd") ; // Database Selection mysql_select_db("$dbname") ; // Validate Connection $result3 = mysql_query("SELECT * FROM tasks WHERE priority = 'Issues' ORDER BY order_no ASC") ; while($row = mysql_fetch_array($result3)) { $job_name = $row['job_name'] ; echo '<li class="ui-state-default"><a href="/">'.$job_name.'</a></li>' ; } // Close Query mysql_close($result3) ; ?> </ul> </div> <div id="tabs-4"> <ul id="sortable4" class="connectedSortable ui-helper-reset"> <?php // Database Connection mysql_connect("$dbhost","$dbuser","$dbpasswd") ; // Database Selection mysql_select_db("$dbname") ; // Validate Connection $result4 = mysql_query("SELECT * FROM tasks WHERE priority = 'Completed' ORDER BY order_no ASC") ; while($row = mysql_fetch_array($result4)) { $job_name = $row['job_name'] ; echo '<li class="ui-state-default"><a href="/">'.$job_name.'</a></li>' ; } // Close Query mysql_close($result4) ; ?> </ul> </div> </div> </body> </html> I have also attached the CSS file if needed. All other .js files are standard jQuery Libary.
  15. I have a Switch case that is not loading a dropdown list. Any help in finding a solution, I would be grateful. <?php $dbc = mysql_connect('','','') or die('Error connecting to MySQL server.'); mysql_select_db('MyDB'); $list['place'] = mysql_query("select * from tblRestaurants order by RestName ASC"); $list['cuisine'] = mysql_query("select * from tblCuisines order by CuisineName ASC"); foreach($list as $key=>$value){ while ($nt = mysql_fetch_assoc($list[$key])) $list_array[$key] = $nt; } if(isset($_GET["ajax"])) { switch($_GET['case']){ case 'place': echo json_encode($list_array['place']); break; case 'cuisine': echo json_encode($list_array['cuisine']); break; } die(); } ?> <!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" xml:lang="en" lang="en"> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function displayPlace() { $.getJSON("Saturday.php?ajax=true", function(data) { $.each(data, function(index, objRecord) { var option=document.createElement("option"); option.value=objRecord.RestID; option.text=objRecord.RestName; $("#Doggie").append('<option value="' + objRecord.RestID + '">' + objRecord.RestName + '</option>'); }); }); } function displayCuisine() { $.getJSON("Saturday.php?ajax=true", function(data) { $.each(data, function(index, objRecord) { var option=document.createElement("option"); option.value=objRecord.CuisineID; option.text=objRecord.CuisineName; $("#Doggie").append('<option value="' + objRecord.CuisineID + '">' + objRecord.CuisineName + '</option>'); }); }); } </script> <title>SEARCH</title> </head> <body> <form> <button type="button" onclick="javascript:displayPlace();">Place</button> <button type="button" onclick="javascript:displayCuisine();">Cuisine</button> <button type="button" onclick="javascript:displayCity();" >City</button> <button type="button" onclick="javascript:displayState();">State</button> <button type="button" onclick="javascript:displayZipCode();">Area</button> <br /> <select name="Doggie" id="Doggie"></select> <br /> </form> </body> </html>
  16. I have 5 buttons. When you click on one, it populates the listbox. The first one works, however I am at loss on how to get the other 4 to work. Any help is appreciated. <?php $dbc = mysql_connect('','',') or die('Error connecting to MySQL server.'); mysql_select_db('MyHead'); $place = mysql_query("select * from tblRestaurants order by RestName ASC"); $cuicine = mysql_query("select * from tblCuisines order by CuisineName ASC"); $city = mysql_query("select * from tblCities order by CityName ASC"); $state = mysql_query("select * from tblStates order by StateName ASC"); $zipcode = mysql_query("select * from tblLocations order by ZipCodeName ASC"); while ($nt= mysql_fetch_assoc($place)) $arrData[] = $nt; if(isset($_GET["ajax"])) { echo json_encode($arrData); //die(); } ?> <!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" xml:lang="en" lang="en"> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function displayPlace() { $.getJSON("index.php?ajax=true", function(data) { $.each(data, function(index, objRecord) { var option=document.createElement("option"); option.value=objRecord.RestID; option.text=objRecord.RestName; $("#Doggie").append('<option value="' + objRecord.RestID + '">' + objRecord.RestName + '</option>'); }); }); } function displayCuisine() { $.getJSON("index.php?ajax=true", function(data) { $.each(data, function(index, objRecord) { var option=document.createElement("option"); option.value=objRecord.CuisineID; option.text=objRecord.CuisineName; $("#Doggie").append('<option value="' + objRecord.CuisineID + '">' + objRecord.CuisineName + '</option>'); }); }); } </script> <title>SEARCH</title> </head> <body> <form> <button type="button" onclick="javascript:displayPlace();">Place</button> <button type="button" onclick="javascript:displayCuisine();">Cuisine</button> <button type="button" onclick="javascript:displayCity();">City</button> <button type="button" onclick="javascript:displayState();">State</button> <button type="button" onclick="javascript:displayZipCode();">Area</button> <br /> <select name="Doggie" id="Doggie"></select> <br /> </form> </body> </html>
  17. I have a button. When I click on the button I want to populate a listbox in AS order. (I would like the listbox to start out blank. Then when the button is clicked, the listbox populates. I have this so far, but when I open the page the box is already populated and the order is far from ASC. Any help s appreciated. Thank you. <?php try { $objDb = new PDO('mysql:host="";dbname=""', '', [email="'@1973'"]'[/email]); $objDb->exec('SET CHARACTER SET utf8'); $sql = "SELECT * FROM `tblRestaurants` WHERE `RestStatus` = 'YES' ORDER BY 'RestName' ASC"; $statement = $objDb->query($sql); $list = $statement->fetchAll(PDO::FETCH_ASSOC); } catch(PDOException $e) { echo 'There was a problem'; } ?> <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8" /> <title>First Box</title> <meta name="description" content="First Box" /> <meta name="keywords" content="First Box" /> <link href="/BigStuff/css/core.css" rel="stylesheet" type="text/css" /> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div id="wrapper"> <div align="center"> <form name="form1" method="post" action=""> <div align="left">First Box <input type="submit" name="First Box" id="First Box" value="Submit"> <select name="Place" size="25" id='Place' class="update"> <option value="">Select one</option> <?php if (!empty($list)) { ?> <?php foreach($list as $row) { ?> <option value="<?php echo $row['RestID']; ?>"> <?php echo $row['RestName']; ?> </option> <?php } ?> <?php } ?> </select> </div> <script src="/BigStuff/js/jquery-1.6.4.min.js" type="text/javascript"></script> <script src="/BigStuff/js/core.js" type="text/javascript"></script> </body> </html>
  18. Here is what I'm attempting to do. I have a rectangle that fixed on a page and is 170 wide and 32 Height, I want to :hover to make an image 170 x 170 slide up from the rectangle when mouse in on over. Then of course collapse when the on mouse out. I have looked all over for this but only get a collapse div answer to make the rectangle grow but that is not my objective. Any help greatly appreciated.
  19. I have a search bar attached with html datalist.html datalist updated with php file. when any word is typed it show the related result like as google when you enter any keyword it show the datalist related to this word and you can easily select any vaule for pressing DOWN ARROW KEY but in my search bar when any keyword is enter is show result like google but when press DOWN ARROW KEY it will not select any value because I m using onkeyup javascript event so when you press DOWN ARROW KEY it is also a key and due to onkeyup event datalist show again due to this reason any value does not select. what did I do,can i cannot use onkeyup event if not then what event I use.
  20. Hey all so Im trying to put data through an AJAX call into this div <div class="scroll-pane2 blue small" style=""> <p id="bulletinBodyArea" style="margin-right:20px;"></p> </div> The AJAX is being triggered when one clicks on one of the links being fed from the database <div class="bulletinSectionAccordion rounded"> <p class="blue" style="font-size:19px;margin-left:23px;margin-top:15px;margin-bottom:10px;">Archives</p> <?php $query = "SELECT * FROM `bulletin` LEFT JOIN `bulletininschool` ON `bulletin`.`id`=`bulletininschool`.`bulletin` WHERE `school` = 2 "; $result=$connection->query($query); while($row = $result->fetch_array()) { echo '<p class="medium titi" style="margin-left:23px;">'.$row['title'].'</p>'; } ?> </div> It gets called and then passes the data $(".titi").click( getBody ); function getBody(){ $("#bulletinBodyArea").load('update/getBody.php'); }; And this is the AJAX function <?php $section='bulletin'; $table="bulletin"; $schoolSelectorTable="bulletininschool"; $schoolSelector="bulletin"; $db_host = "localhost"; $db_user = "root"; $db_pass = ""; $db_name = "isl"; mysql_connect($db_host, $db_user, $db_pass, $db_name); mysql_select_db("isl") or die(mysql_error()); $states = mysql_query("SELECT * FROM `bulletin` LEFT JOIN `bulletininschool` ON `bulletin`.`id`=`bulletininschool`.`bulletin` WHERE `school` = 2" ); while($state = mysql_fetch_array($states)){ echo "<p>".$state['body']."</p>"; } ?> Now the links that one clicks that are fed from the database are actually article titles, and when one clicks on a specific title the AJAX call should go and fetch the body text associated with that article. But I'm having trouble understanding how I should go through that. I'm doing the correct queries and getting the titles and the bodies but I just cant figure out how to associate them. Do I pass a variable to the AJAX call? Thank you
  21. Hi , m writing a code to add some dynamic values , following is my code which is currently hardcoded <!DOCTYPE html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $.post("Myfile.php", { name:"Donald Duck", city:"Duckburg" }, function(data,status){ alert("Data: " + data + "\nStatus: " + status); }); }); }); </script> </head> <body> <button>Send an HTTP POST request to a page and get the result back</button> <input type="text" id="txt1"> </body> </html> Now i want to send some value in city : entered from the text filed , i used city :$('input[type=text]').val() but it did not work Please Suggest. Thanks!!!
  22. hi friends, im trying a case, n i have problem on it, im gonna input multiple data , here sample my form html: <div id="form_name"> <select id="name_emp"> <option value="1234">joko</option> <option value="9900">Rudi</option> <option value="7786">anto</option> </select> <div id="id_emp"> </div> </div> <button id="addBtn">Add Name</button> n i want, for example, a user can show that select elemen above more than 1, so i create jquery code below: $("#addBtn").click(function() { $("#form_name").append('<select id="name_emp"><option value="1234">joko</option><option value="9900">Rudi</option> <option value="7786">anto</option> </select> <div id="id_emp"> </div>'); }); so, if a user click Add Name button, the select elemen wil show again. after a user choose from select elemen, i want jquery show the ID, example, if i choose joko, ID will show 1234 n so forth. so i create jquery code below: $('#name_emp').change(function() { var ID = $("#name_emp").val(); $('#id_emp').html(ID); }); it works when i choose the name n the ID is out between <div id="id_emp"></div> at first time, but, when i click Add Name button to show again the select elemen, n i choose employee name, the ID is not out,that's my problem friends, can you help me? thanks before....
  23. im working with instagrams api and im not sure what to do next ... i so far have there access_token , but i dont know how to get the rest of the users information. the code below is given to me by instagram to retrieve the users information but i dont know what language to use it with , i have tried php but i dont know what to do with it ? please help thank you i have the access token , client id , client secret , and redirect uri. but do i change the CODE to a variable for the token ? curl \-F 'client_id=CLIENT-ID' \ -F 'client_secret=CLIENT-SECRET' \ -F 'grant_type=authorization_code' \ -F 'redirect_uri=YOUR-REDIRECT-URI' \ -F 'code=CODE' \https://api.instagram.com/oauth/access_token
  24. Hello, I am trying to load more search resutls in my search.php with this code <script> function yHandler($q){ var result= document.getElementById('mydiv'); var contentHeight = result.offsetHeight; var yOffset = window.pageYOffset; var y = yOffset + window.innerHeight; if(y >= contentHeight){ var query = "<?PHP echo $_POST['search']?>"; $.ajax({ type: "POST", url: "search.php", $q:query, success: function(res) { $("#more").append(res); } }); } } window.onscroll = yHandler; </script> My biggest problem is that it will load the page with no results because the $q is not correctly sent. If I try alert(query); it shows the search term so the problem must be when im defining my data in the ajax request. Any ideas? Thanks in advance
  25. hi im working with instagram API and it uses Curl ... i sorta get it but is there a site where i could learn more or anyone here that knows about curl?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.