Search the Community
Showing results for tags 'javascript'.
-
Hello all, I am trying to call two functions onclick of a submit button. the two functions inturn go to two php scripts..i want the php scripts to be run one after the other. But, its not working. Please take a look at my code and suggest some changes my html : <form method="post" action="" name="form"> <label> New Data set: </label> <input type="radio" name="url" value="NetOptInput2.html" id="ex1" required/> Yes <input type="radio" name="url" value="NetOptResult2.html" id="ex2" required/> No <br><br><br> <label>Dataset description: </label> <input type="text" name="dataset" id="field1" size="30" placeholder="" readonly><br><br><br> <label>Token Number : </label><input type="text" name="token" id="field2" size="6" placeholder="" readonly><br><br><br> <div style="text-align: center"><br> <input type="Submit" name="submit" value="Submit" class="submit" onclick="return(OnButton2() && OnButton1())"> <div class="spacer"></div> </form> My Javascript <!-- this function navigates user according to the radio button selection--> <script language="Javascript"> function OnButton1() { document.form.action = "Input1a.php" // document.form.target = "_blank"; // Open in a new window //document.form.submit(); // Submit the page // return true; } function OnButton2() { document.form.action = "Input1b.php" //document.form.target="_blank"; // document.form.submit(); // Submit the page // return true; } <!--This function disables the Token Number form if the user clicks "yes" radio button and disables Dataset if "No"--> <script type="text/javascript"> $(function(){ $("#ex1, #ex2").change(function(){ $("#field1, #field2").val("").attr("readonly",true); if($("#ex1").is(":checked")){ $("#field1").removeAttr("readonly"); $("#field1").focus(); } else if($("#ex2").is(":checked")){ $("#field2").removeAttr("readonly"); $("#field2").focus(); } }); }); MY php file1 if (isset($_POST) && $_POST['url1'] == "Yes") { header('Location: NetOptInput2.html'); } else if (isset($_POST) && $_POST['url2'] == "No") { header('Location: NetOptResult2.html'); } my php file 2 if (isset($_POST['submit'])) { $dataset = $_POST['dataset']; $tokennumber = $_POST['tokennumber']; $data = "$dataset | $tokennumber\n"; $file = "input.txt"; $fp = fopen($file, "w") or die("Couldn't open $file for writing!"); fwrite($fp, $data) or die("Couldn't write values to file!"); fclose($fp); $message = "Saved to $file successfully!"; }
-
My code is, <?php function getreg($id) {return file_get_contents('http://arcbots.com/userinfo.php?id='.$id);} function getID($reg) {return file_get_contents('http://arcbots.com/userinfo.php?reg='.$reg);} function lastseen($user) {return file_get_contents('http://arcbots.com/userinfo.php?lastseen='.$user);} function getdisplayname($user) {return file_get_contents('http://arcbots.com/userinfo.php?displayname='.$user);} function gethomepage($user) {return file_get_contents('http://arcbots.com/userinfo.php?homepage='.$user);} function getavatar($user) {return file_get_contents('http://arcbots.com/userinfo.php?avatar='.$user);} function getuserinfo($user) {return file_get_contents('http://arcbots.com/userinfo.php?info='.$user);} ?> <center>This will search a users ID and return the Registered name</center> <html> <link rel="stylesheet" type="text/css" href="style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/custom.css" /> <center><form method="post" /> <input type="text" name="search"> <input type="submit" value="get regname" name="submit"> </form></center> <?php function display() { echo getReg($_POST['search']); } if(isset($_POST["search"])) { display(); } ?> </html> I have two quick questions: 1 - How would I output the returned information it gives me in a popup window. side note: I'd like to keep the original output on the page just incase their browser blocks the popup. 2 - How would I create a usable dropdown menu that can select what function they want to use
-
I am looking for a webdesigner / coder who can create the basic CSS for a fluid adaptive website. The main layout would be something like the 'Mondrian' example here http://designshack.net/articles/css/5-really-useful-responsive-web-design-patterns/ navigation design would be something like this. http://www.impressivewebs.com/demo-files/css3-glow-tabs/ At the moment I am too busy with different projects to spend a lot of time figuring out the new CSS possibilities and therefore I am looking for someone to help me. Please contact me by PM on phpfreaks thank you anatak
-
- css
- javascript
-
(and 1 more)
Tagged with:
-
Hello, I am currently developing a site but I have ran into a problem. The Google Maps is not rendering correctly and a grey area is visible. I have tried to use the resize facility initiated on window.onload and I have provided inline styling but to no avail. Any suggestion will be greatly appreciated. The Page with map implement can be found at http://www.esfdev.co.uk/bede/contact-us-and-lettings/find-us/ .Again and help will be greatly appreciated.
- 1 reply
-
- googlemaps
- jquery
-
(and 1 more)
Tagged with:
-
my code below works perfect in Mozilla and Chrome but not in IE8, when i select a Radio button in IE its showing other options for other Radio button, need help in fixing the issue in IE8 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="jquery.chained.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <link rel="stylesheet" href="style.css" /> <script type="text/javascript" src="infratool.js"></script> <script> $(function() { $("#submit").hide(); $("#Category").change(function() { window.location = $(this).val().split(" ")[0]; if(loc) window.location.href = loc; }) }); </script> <table width="392" border="0"> <td colspan="2" align="center"><form id="form1" name="form1" method="post" action=""> <tr> <td align="center"> <label><input name="Radio1" type="radio" id="TestA" value="TestA" onclick="showSelect();" />TestA</label> <label><input name="Radio1" type="radio" id="TestB" value="TestB" onclick="showSelect();" />TestB</label> </td> </tr> </form> <div id="div-id" align="center"><select name="Category" id="Category" class="hide"> <option value=" TestA TestB" selected="selected">--</option> <option value="TestA1.php TestA">TestA1</option> <option value="TestA2.php TestA">TestA2</option> <option value="TestA3.php TestA">TestA3</option> <option value="TestA4.php TestA">TestA4</option> <option value="TestA5.php TestA">TestA5</option> <option value="TestB1.php TestB">TestB1</option> <option value="TestB2.php TestB">TestB2</option> <option value="TestB3.php TestB">TestB3</option> <option value="TestB4.php TestB">TestB4</option> <option value="TestB5.php TestB">TestB5</option> <option value="TestB6.php TestB">TestB6</option> </select><input type="submit" value="Go" id="submit"/> </div> </table> here are the other java scripts ive been using //Show Select option after clicking Radio button: function showSelect() { var select = document.getElementById('Category'); select.className = 'show'; } //Select option, separates the link from Class $(function(){ var select = $('#Category'), options = select.find('option'); $('[type="radio"]').click(function(){ var visibleItems = options.filter('[value*="' + $(this).val() + '"]').show(); options.not(visibleItems).hide(); if(visibleItems.length > 0) { select.val(visibleItems.eq(0).val()); } }); }); $(function() { $("#submit").hide(); $("#Category").change(function() { window.location = $(this).val().split(" ")[0]; if(loc) window.location.href = loc; }) }); and here is the screenshot in Firefox and IE8 respectively.
-
Hi all- this is my first post here, I've been working with javascript for only a few months and can usually find the answers by googling, but I am kind of stumped on this one. I have a form where I can select toppings for a pizza and when you change the dropdown selector to choose a topping, a javascript function posts to a standalone php file to automatically update the database. It works great in chrome, but I can't seem to get it to work in IE. If I run the standalone script directly in a browser window, it works, even in IE. So I am assuming that my javascript code that posts to the file is not able to post to the file in IE for some reason. Here is the js function trying to post to the form: function updateCart() { var filename = "<?php echo $server;?>update_cart.php"; $.post(filename, $("#cartform").serialize()); alert("file name: " +filename); } The alert pops up and correctly displays the path to the file in both chrome and IE. Does anyone see any obvious reasons why this wouldn't work in IE? thanks for your help, Andy
- 1 reply
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
Hi! I'm making a time laps calculator based off of the equation found http://americandslr.com/2010/10/time-lapse-calculator/ there. I'm completely done with the functional part of it. Now I need to worry about the aesthetic part of it. Here is the code: <?php if (isset($_POST['filming'])) $hour = $_POST['filming']; if (isset($_POST['framerate'])) $framerate = $_POST['framerate']; if (isset($_POST['dtrt'])) $dtrt = $_POST['dtrt']; $half = $hour * 3600; $halftwo = $framerate * $dtrt; $answer = $half / $halftwo; ?> <!DOCTYPE html> <html lang='en'> <head> <title>Timelapse Calculator</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <div class="well span 5"> <form class="form-horizontal" method="POST"> <fieldset> <!-- Form Name --> <legend><h1><center>Timelapse Calculator</h1></center><br></legend> <!-- Text input--> <div class="control-group"> <label class="control-label" for="filming"><strong>Film Time (in hours)</strong></label> <div class="controls"> <input id="filming" name="filming" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">1 hour would be "1", 1 and a half hours would be "1.5" etc. </p> </div> </div> <!-- Text input--> <div class="control-group"> <label class="control-label" for="framerate"><strong>Frame Rate</strong></label> <div class="controls"> <input id="framerate" name="framerate" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">How fast will it be presented?</p> </div> </div> <!-- Text input--> <div class="control-group"> <label class="control-label" for="dtrt"><strong>Duration</strong></label> <div class="controls"> <input id="dtrt" name="dtrt" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">How long do you want the time lapse to last? <u>IN SECONDS</u></p> </div> </div> <!-- Button --> <div class="control-group"> <label class="control-label" for="submit"></label> <div class="controls"> <input type="submit" class="btn btn-primary btn-large" value="Submit"/> </div> </div> </fieldset> </form> <h2><center><strong><?php echo $answer . " seconds between picture" ?></center></strong></h2> </div> <script src="http://code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html> (yes i'm using bootstrap) Here is a screenshot of what it looks like before and after you submit: Before submission: http://gyazo.com/361d109f0af010fcda4d90288b338566 After submission: http://gyazo.com/cf1c2c2089af3f6b4bf349aeab7fc1d4 1. how do I make it round to the nearest tenth? When I used "round($answer, 1);" it crashed my script. 2. How can I make the "seconds between picture" only appear after you press submit? Thanks, I'm a noob. Fisher
- 1 reply
-
- javascript
- math
-
(and 2 more)
Tagged with:
-
Good Day, I have created a web page with more than 10 text boxes, i know how to use all validations from vs . now i want to apply validations using Javascript. here are my problems below. 1.For Email; I want a textbox to change border color to red if it is invalid email, belows it is what i have so far.. <script type="text/javascript"> ar emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert("Please enter a valid email address.") e.select() } return returnval } </script> on the text box; <asp:TextBox ID="txtEmail" name="email" onClick="return checkmail(this.myemail)" runat="server" </asp:TextBox> 2.For Numbers This texbox will only allows numbers only ,I want a textbox to change border color to red if it is invalid input, belows it is what i have so far.. <script type="text/javascript"> function numeralsOnly(evt) { evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); if (charCode > 31 && (charCode < 48 || charCode > 57)) { alert("Enter numbers only in this field."); return false; } return true; } </script> on the text box; <asp:TextBox ID="txtFullName" onkeypress="return numeralsOnly(event)" runat="server"</asp:TextBox> 2.For Letters This texbox will only allows Letters only,I want a textbox to change border color to red if it is invalid input, belows it is what i have so far.. <script type="text/javascript"> function lettersOnly(evt) { evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); if (charCode > 31 && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122)) { alert("Enter letters only."); return false; } return true; } </script> on the text box; <asp:TextBox ID="txtFullName" onkeypress="return lettersOnly(event)" runat="server"</asp:TextBox> Thanks for your help....
-
hi i would like to have my css test box attached to the side of the box like it is on the second picture ... any way to do it ? #socialbox { background-color: #FFF; padding: 7px; height:200px; width:35px; border: 1px solid #DBDBDB; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; -webkit-box-shadow: #E4E4E4 0px 0px 5px; -moz-box-shadow: #E4E4E4 0px 0px 5px; box-shadow:#E4E4E4 0px 0px 5px; margin-bottom: 5px; /* max-width:50px; max-height:100px; */ float:right; margin-right:180px; }
-
Hi Guys, I have a simple mysql_num_rows() expects parameter 1 to be resource, boolean given error in my script, I have tried to debug it myself but I don't understand why the script doesn't think the variable "$query" isn't an integer. I am trying to create a login form for users who are already registered and I want them to be able to see instant feedback as to whether their info has been accepted or not. The users won't be redirected though. testlogin.php <?php $name = $_GET['name']; $password = $_GET['password']; if (!$name && $password) { echo "Error"; exit; } mysql_connect("localhost" , "root" , "") or die("Issue with connection!"); mysql_select_db("testlogin"); $query = mysql_query("SELECT * FROM users WHERE Name='".$name."'"); $name = $_GET['name']; $password = $_GET['password']; if(!$name && $password) { echo 'No name or password'; exit(); } mysql_connect("localhost","root", ""); mysql_select_db("testlogin"); $query = mysql_query("SELECT * FROM users WHERE Name ='".$name."'"); $numrows = mysql_num_rows($query); if($numrows !=0) { while($row = mysql_fetch_assoc($query)) { $dbname = $row['Username']; $dbpassword = $row['password']; } if($name == $dbname && $password == $dbpassword) { echo "you are in!"; }else { echo "Please enter a valid username and password"; } }else { echo "Your name is not registered!"; } ?>
-
Hi all, This problem is killing me. I hope / pray someone can help. Essentially I need to pass a JS variable to a PHP variable without refresh/form submission or redirecting. I'm new to Ajax so please be patient The owner of this site generally lives in 3 countries lucky ******. When he logs in he wants the contact page updated with his current number. I have a form with hidden fields that return the address location using an ajax call to ipinfo.io - this works fine. <script> $(function() { var admin = <?php echo json_encode($admin->isAdmin($user['username'])); ?>; var phone=""; if(admin == true){ $.ajax({ url:"http://ipinfo.io", dataType:'jsonp' }) .success(function(response){ $("#address").val(response.country); $("input[id=address]").val(response.country); var testLoc = $('#address').val(); if(testLoc == "GB"){ phone = "<?php echo $gb?>"; $("#phone").append(phone); }else if(testLoc == "GABON"){ phone = "<?php echo $gabon?>"; $("#phone").append(phone); }else if(testLoc == "THAILAND"){ phone = "<?php echo $thai?>"; $("#phone").append(phone); } }); var time = new Date(); $("#localTime").append(time); }else{ //alert("Not Admin"); $("#phone").append(phone); } }); </script> The above essentuially checks to see that he is THE admin, if it is it then sets the hidden field value to be the country, that is then placed in the testLoc variable and depending on what it is, it spits out the number. This all works well unless of course you visit the site and you're not the admin. All you see is an empty string. I need to get that phone variable or location variable, either of them really from the js into a php variable. That way when a normal joey visits the page I can just echo out that variable instead. phone or location var in js script to php variable?
- 1 reply
-
- ajax
- javascript
-
(and 1 more)
Tagged with:
-
<link type="text/css" href="assets/css/main.css" rel="stylesheet" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="assets/js/google_maps/jquery-1.9.1.js"></script> <script type="text/javascript" src="assets/js/google_maps/jquery-ui-1.10.3.custom.min.js"></script> <script type="text/javascript" src="assets/js/google_maps/main.js"></script> <script> function updatelocation(){ var lat = document.getElementById('latitude').value; var long = document.getElementById('longitude').value; newlocation = lat+ "," +long; alert(newlocation); } </script> <div class="row"> <div class="large-12 small-6 columns"> <label>Address: </label><input id="address" type="text"/> <div id="map_canvas" style="width:100%; height:300px"></div> <br/> <label>latitude: </label><input id="latitude" type="text"/><br/> <label>longitude: </label><input id="longitude" type="text"/> <input name="setlocation" type="button" onClick="javascript:updatelocation()" value="Set As Your Location"> </div> </div> Here is my code can some one help me? The display should be right next to the address textbox.
-
Hello, I'm trying to retrieve dates from the database based on a selection. If a user selects singer A for example, then I'm going through the database and get the unavailable dates of singer A. var unavailableDates; function unavailable(date) { dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear(); if ($.inArray(dmy, unavailableDates) == -1) { return [true, ""]; } else { return [false, "", "Unavailable"]; } } $(document).ready(function() { $("#datepicker").datepicker({ dateFormat: 'yy-mm-dd', beforeShowDay: unavailable, minDate: 0, firstDay: 1, // rows starts on Monday changeMonth: true, changeYear: true, showOtherMonths: true, selectOtherMonths: true, altField: '#date_due', altFormat: 'yy-mm-dd' }); $('#datepicker').focus(function(){ //alert($('#name').html()); $.ajax({ url: 'getDates.php', data: "artist_id="+$('#name').html(), dataType: 'json', success: function(data) { alert(data) } }); }) }); Everything works fine. Using the "getDates.php" I retrieved the dates and pass them through the function. But how can I pass the data (after success: function) to the unavailable dates above? I have the dates from database but I don't know how to link them with the array "unavailableDates" (line 1) in order to show unavailable dates in datePicker.
- 2 replies
-
- json
- javascript
-
(and 2 more)
Tagged with:
-
Hello all, Im working on a back-end system that sends push notifications. At the moment on click of send button the loading gif appears underneath. I would like the send button to disappear and for the loading gif to appear as it is now. How can I implement this feature ? Any help would be much appreciated <div class="row-fluid"> <input type="submit" name="badgeSubmit" class="span5 offset7 blue-button" value="Send" onClick='return checkvalue() && toggle(); return false;' /> <img style="position:relative; top:20px;"src="/images/sending.gif" alt="loading" class="sending"> </div>
-
Hello, I am trying to create an array where by the items listed are nested with the names and the array spat out is easy to use when I am creating an ajax function with data from it all. Below is an idea of what I need to do: # This is where I am grabbing the data from the instagram class $data_url[] = $data->images->standard_resolution->url; $data_link[] = $data->link; $data_id[] = $data->getId(); $data_likes[] = $data->likes->count; {["images":[ ["data_url":[ ["http:\/\/distilleryimage4.s3.amazonaws.com\/f8e5e2fafe8811e2a42922000a9e51c4_7.jpg"] ], ["data_link":[ ["http:\/\/instagram.com\/p\/cq2pjLMNNE\/"] ], ["data_id": [516465457066201924_288233123] ], ["data_likes": [18] ] ] ] } In my current ajax.php page, I am creating a place where data can be captured and I can use it to get the images and place them into a page. Here is what I have got so far: $instagram = new Instagram\Instagram; $instagram->setAccessToken($_SESSION['instagram_access_token']); $token = $_SESSION['instagram_access_token']; //$clientID = $_SESSION['client_id']; $current_user = $instagram->getCurrentUser(); $tag = $instagram->getTag('folkclothing'); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); /* $params = isset( $_GET['max_tag_id'] ) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null; */ /* $media = $tag->getMedia($params); */ /* $next_page = $media->getNext(); */ /* // Receive new data $imageMedia = $instagram->pagination($media); */ // Collect everything for json output $images = array(); $data_link = array(); $data_id = array(); $data_likes = array(); foreach ($media as $data) { $images[] = array($data_url[] = $data->images->standard_resolution->url,$data_link[] = $data->link, $data_id[] = $data->getId(), $data_likes[] = $data->likes->count); } echo json_encode(array( 'next_id' => $media->getNextMaxTagId(), 'images' => $images )); Below is what my /ajax/ url gives me: {"next_id":"1374887530845","images":[["http:\/\/distilleryimage4.s3.amazonaws.com\/f8e5e2fafe8811e2a42922000a9e51c4_7.jpg","http:\/\/instagram.com\/p\/cq2pjLMNNE\/","516465457066201924_288233123",18],["http:\/\/distilleryimage10.s3.amazonaws.com\/46f790e0fdaf11e29de622000ae90e7b_7.jpg","http:\/\/instagram.com\/p\/coEUD0MyGO\/","515681128006492558_197168271",23],["http:\/\/distilleryimage6.s3.amazonaws.com\/7e510fa6fcee11e29a4b22000a1fb593_7.jpg","http:\/\/instagram.com\/p\/clmYo1AgU6\/","514986551277651258_20025128",25],["http:\/\/distilleryimage0.s3.amazonaws.com\/4f41be96fc3411e2829822000a9f1487_7.jpg","http:\/\/instagram.com\/p\/cjN3PipYkE\/","514315753313634564_190097401",10],["http:\/\/distilleryimage0.s3.amazonaws.com\/bcc8d83cfb9911e2921e22000aa81fd0_7.jpg","http:\/\/instagram.com\/p\/chPPNdGDhI\/","513758848433535048_6206549",13],["http:\/\/distilleryimage2.s3.amazonaws.com\/ef97af2efb5611e2b16122000a1f9e61_7.jpg","http:\/\/instagram.com\/p\/cgYg4ljpby\/","513518170419402482_52465932",1],["http:\/\/distilleryimage5.s3.amazonaws.com\/8e7bbf04fa9e11e2aea022000a9d0ee7_7.jpg","http:\/\/instagram.com\/p\/ceBeGXNpA9\/","512853874029531197_20203491",2],["http:\/\/distilleryimage4.s3.amazonaws.com\/96dc4444f9f811e2b88d22000a1fd1dd_7.jpg","http:\/\/instagram.com\/p\/cb5gooAgW4\/","512255913931965880_20025128",6],["http:\/\/distilleryimage11.s3.amazonaws.com\/6b80e884f9dc11e29b2522000a9f13d5_7.jpg","http:\/\/instagram.com\/p\/cbibv3JW9H\/","512154423034998599_430907394",20],["http:\/\/distilleryimage7.s3.amazonaws.com\/64f82bd6f95411e2a73522000a1faf50_7.jpg","http:\/\/instagram.com\/p\/cZzAF8syFb\/","511664339442409819_197168271",16],["http:\/\/distilleryimage10.s3.amazonaws.com\/b54645f4f93711e283e622000a1fb86d_7.jpg","http:\/\/instagram.com\/p\/cZbgGrlSzW\/","511560986135964886_187431354",17],["http:\/\/distilleryimage8.s3.amazonaws.com\/a9fc18a2f87111e29c8b22000a9f18f4_7.jpg","http:\/\/instagram.com\/p\/cW5Q5CBrlw\/","510847457153169776_378485429",6],["http:\/\/distilleryimage0.s3.amazonaws.com\/55b6269cf86311e2b5f422000a1f9a34_7.jpg","http:\/\/instagram.com\/p\/cWthoKit5E\/","510795830715407940_203990694",16],["http:\/\/distilleryimage9.s3.amazonaws.com\/bff691e2f82a11e2939b22000a1f9251_7.jpg","http:\/\/instagram.com\/p\/cV_K8mBu9R\/","510591961963884369_256035442",12],["http:\/\/distilleryimage4.s3.amazonaws.com\/5ef4c3c0f73811e2890322000a9e48f1_7.jpg","http:\/\/instagram.com\/p\/cS4nTwwE_U\/","509718699729506260_37194114",34],["http:\/\/distilleryimage8.s3.amazonaws.com\/a1b5f0acf6cb11e2957722000a1f9a39_7.jpg","http:\/\/instagram.com\/p\/cRfiPgmAWQ\/","509326925426591120_453101536",11],["http:\/\/distilleryimage6.s3.amazonaws.com\/4bf62240f68511e29aee22000a9f38e6_7.jpg","http:\/\/instagram.com\/p\/cQl6qiBzdu\/","509073517011482478_5670460",223],["http:\/\/distilleryimage1.s3.amazonaws.com\/d23848d6f61e11e2807c22000a9e06c7_7.jpg","http:\/\/instagram.com\/p\/cPR9_otpGt\/","508704309923713453_20203491",6]]} Can anyone guide me into the best way I can do this so it gives me an array from my ajax.php so I can grab the data and place it into my page better? I have tried numerous techniques but they have not worked at all. Thanks, Mark
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
I am building a relatively small app in laravel. Currently I am trying to create a load more button to load more images into a container in the view. Would anyone know when clicking load more I get an internal server error? Here is my set up: View for my images: $instagram = new Instagram\Instagram; $instagram->setAccessToken($_SESSION['instagram_access_token']); $token = $_SESSION['instagram_access_token']; //$clientID = $_SESSION['client_id']; $current_user = $instagram->getCurrentUser(); $tag = $instagram->getTag('folkclothing'); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); $liked_media = $current_user->getLikedMedia(); echo '<section id="images">'; foreach ( $media as $item ) { echo '<article class="instagram-image">'; // define the form and set the action to POST to send the data to this script echo '<form class="forms" action="'; echo URL::current(); echo '" method="post">'; $id = $item->getId(); echo '<a class="fancybox" href="' . $item->link . '"><img src="' . $item->images->standard_resolution->url . '" /></a>'; if ( $current_user->likes($item) ){ echo '<button class="ajax instabtn unlike icon-heart" type="submit" name="action" value="Unlike"></button>'; } else { echo '<button class="ajax instabtn like icon-heart" type="submit" name="action" value="Like"></button>'; } echo '<input type="hidden" name="id" value="'; echo $id; echo '">'; echo '<p>'; echo $item->likes->count; echo '</p>'; //echo '<p>'.$item->getId().'</p>'; //echo '<p>By: <em>' . $item->user->username . '</em> </p>'; //echo '<p>Date: ' . date('d M Y h:i:s', $item->created_time) . '</p>'; //echo '<p>$item->comments->count . ' comment(s). ' . $item->likes->count . ' likes. '; echo '</form>'; echo '</article>'; } echo '</section>'; Here the instagram class generates the images and puts them into the div through a loop. Below is a load more button storing the data need in it. Load more button: echo "<br><button id=\"more\" data-maxid=\"{$media->getNextMaxTagId()}\" data-tag=\"{$tag}\">Load more ...</button>"; And then there is an ajax view that stores the relevant data for the images to be found for the next page: <?php // set up autoloader function app_autoloader($class) { include './' . $class . '.php'; } spl_autoload_register('app_autoloader'); // Initialize class for public requests $instagram = new Instagram\Instagram; // Receive AJAX request and create call object $tag = $_GET['tag']; $clientID = $instagram->getApiKey(); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); $call = new stdClass; $call->next_max_id = $maxID; $call->next_url = "https://api.instagram.com/v1/tags/{$tag}/media/recent?client_id={$clientID}&max_tag_id={$media->getNextMaxTagId()}"; // Receive new data $media = $instagram->pagination($call); // Collect everything for json output $images = array(); foreach ($media->data as $data) { $images[] = $data->images->standard_resolution->url; } echo json_encode(array( 'next_id' => $media->getNextMaxTagId, 'images' => $images )); This page finds the tag and gets the media for that tag and finds the next_max_id. In my jquery I use and ajax call to get this data and load the images into my div but instead I get an internal server error like so: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://client:8888/ajax?tag=client&max_tag_id=1374869525975&_=137571153802 Does anyone have an idea why it would not produce the results? I know its not too far off. Thanks, Mark ajax.blade.php image.blade.php
-
Hello, I'm here with a question that maybe silly for most of you but I just can't handle it. As I know, there's no way in built in PHP inside JS because diferent kind of languages ( Server Side and Client Side ). But I have a problem that I need help to handle. I have a multilanguage system in my site ( PHP ) and form validations ( JS ). I have the error messages showed by JS instantly, but I can only print text, not a PHP variable info. For example: $(function() { // validate signup form on keyup and submit $("#loginform").validate({ rules: { user: "required", password: "required", }, messages: { user: "Please enter your username or email.", password: "Please enter your password", } }); }); And my multilanguage system uses the following system: $lang['login_error'] = 'Incorrect details provided.'; There is any way to make something like this: $(function() { // validate signup form on keyup and submit $("#loginform").validate({ rules: { user: "required", password: "required", }, messages: { user: <?php echo $lang[login_error']; ?>, password: "Please enter your password", } }); }); I know this doesn't work, but it's to make an easy example in what I need, because depending the language the user as choosen, the error should be there in that language, not only in one language. Could you please help me to handle this ? Thanks in advance.
- 5 replies
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
Developing CART for Online Shopping I am trying to add buttons on html page and the code is working............I have some products in <SELECT> tag i.e. Product 1,Product 2,Product 3,Product 4,Product 5......... I create an array "list_array" and storing all the values in array dynamically... I click on <BUTTON>ADD </BUTTON> and it reads the value from <SELECT> tag and add it into array...........To display all the products, I execute the loop and display all the items in array with a <BUTTON>REMOVE</BUTTON> in-front of every product.......... To delete the particular product, I can select it in <SELECT> tag and then click on delete button..........It removes the element from array .........To display the cart, I am using the loop again, and it shows all the products after clicking the <BUTTON>Display</BUTTON> Now the issue that I am facing here is that I am adding <BUTTON>REMOVE</BUTTON> button when I am displaying the products that have been added in CART, the code of java_script is listed below function display() { string = ""; str=""; for(j=0;j<i;j++) { str = list_array[j]+"_"+j; string = list_array[j]+" <button onclick='remove_me(this)' id="+str+">Remove</button><br>"+string; } document.getElementById('write').innerHTML = "Array:<br> " + string; document.getElementById('i_val').innerHTML = "I: " + i; } Now, I am trying every way to make a code that will help me in removing the product by clicking on <BUTTON>REMOVE</BUTTON>, I hope I have explained everything here, so, help me to fix this issue...............
-
I have this array that has n elements ---> list_array = new Array(); it contains ['Product 1','Product 2','Product 3','Product 4','Product 5','Product 6','Product 7','Product 8'] what I am trying to do is that starting a loop from j=0 to j<n, I am adding button on html page, now when I click on button, it must remove itself from the page. I want to do this with the help of javascript...Is there anyone who can help ??? If I click on "product 8", the page must display other 7 buttons and it must delete the button itself on the page..... function create() { for(j=0;j<i;j++) { "<button onclick='remove_me(this)' id="+list_array[j]+">Remove</button><br>"; } } function remove_me(obj) { _button = obj.id; remove(_button); } I am trying to perform this operation, however, it only receive "Product" in obj.id.............It skips the text after the first whitespace..... I hope that you got my concern, looking for quick reply.......
- 1 reply
-
- javascript
- button
-
(and 1 more)
Tagged with:
-
Hi guys, I have a relatively hard question. The problem is that I must leave the HTML code as it is and not put any divs around the image tags. How can I add a class or a selector to an image tag so that I can style that specific image tag for a specific style sheet. The reason why I'm doing this is because my code is styled in three different style sheets for responsive web design. I need a way to select these image tags using an identifier without affect the html code to go crazy in other layouts. <img src="./ajaxfiles/globebuttons/1xtremevision.png" alt="" name="btn3" id="btn3" onclick="MM_swapImage('car','','./ajaxfiles/carbackgrounds/XtremeVision-E-City.jpg','btn1','','./ajaxfiles/globebuttons/1standardreplacement.png','btn2','','./ajaxfiles/globebuttons/1powervision.png','btn3','','./ajaxfiles/globebuttons/xtremevision.png','btn4','','./ajaxfiles/globebuttons/1bluevisionultra.png','btn5','','./ajaxfiles/globebuttons/1crystalvision.png','btn6','','./ajaxfiles/globebuttons/1diamondvision.png',1)" /> Any help would be much appreciated, please post a way to style these image tags ? All the best, Adam
-
i have resposive webpage layout with masonry. when user resizes the browser below certain viewport width, i destroy masonry. but after user resized back, i can't reinitialize masonry. it just will not arrange the blocks as it should. any ideas how to fix this?
-
- jquery
- javascript
-
(and 1 more)
Tagged with:
-
Hi guys, I'm trying to build the following functionality, but find myself seriously lacking in coding aptitude and knowledge. I'm hoping you guys can help me out. Ultimate goal: Clean search bar in middle of screen with no submit button; typing specific text ex. "test" brings an html/javascript widget from a separate file ex. "test1.html" and includes that content below the search bar all without a refresh. My current solution (and note that the code is retrofitted from a different project that someone else wrote), is an if-then solution, whereby if the text in the input == "test" then the page includes the test1.html file. main.html <!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=iso-8859-1" /> <title>Testing</title> <script language="javascript" type="text/javascript"> var XMLHttpRequestObject_test = false; var strSend; if (window.XMLHttpRequest) { XMLHttpRequestObject_test = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject_test = new ActiveXObject("Microsoft.XMLHTTP"); } var i; var finished; function test() { if (XMLHttpRequestObject_test) { strSend = "receive.php?"; i = 0; finished = false; while (finished != true) { if (document.input1.elements[i].type == "text") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } else if (document.input1.elements[i].type == "checkbox") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].checked; } else if (document.input1.elements[i].type == "hidden") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } else if (document.input1.elements[i].type == "password") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } i = i + 1; if (document.input1.elements[i] != "[object HTMLInputElement]") { finished = true; } else { finished = false; } } XMLHttpRequestObject_test.open("GET", strSend); XMLHttpRequestObject_test.onreadystatechange = function () { if (XMLHttpRequestObject_test.readyState == 4 && XMLHttpRequestObject_test.status == 200) { document.getElementById('test').innerHTML = XMLHttpRequestObject_test.responseText; } } XMLHttpRequestObject_test.send(null); } } </script> </head> <body> <form name="input1"> <input name="txt1" type="text" /> </form><br /> <input name="cmd_submit" type="button" value="Submit" onclick="test()" /><br/> <br/> <div id="test"></div> </body> </html> receive.php <?php if($_REQUEST['txt1'] == "test") { include('test1.html'); } else { echo stripslashes($_REQUEST['txt1']); } ?> Test1.html (the content to be included) <?php echo '<script type="text/javascript" src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100840413740199312943/stock-quotes.xml&up_stockList=%5EIXIC%2C%5EGSPC%2C%5EN225%2C%5EHSI%2C%5ESTI%2C%5EFTSE%2C%5EGDAXI%2C%5EFCHI&up_chart_bool=1&up_font_size=12&up_symbol_bool=0&up_chart_period=0&up_refresh_secs=30&synd=open&w=290&h=300&title=Stock+Quotes&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>'; echo '<p class="p1">ONETEST!</p>'; ?> Result after typing "test" into search bar (no quotes) [SEARCH BAR] ONETEST! Very accurate representation of the search bar, I know. But the google widget that I used to test this doesn't show up, only the text. I have tried many variations on trying to echo the javascript such that php doesn't chuck it, but nothing. // I have alternative code that includes the content via ajax without the use of php and it brings the widget in without a problem, however, I have no idea how to make that "search bar - if string == 'test', then, show include" paradigm without php. Thank you in advance, Alex Long time visitor, first time poster
-
</html> <script type="text/javascript"> var inc = 10; function move_down() { bar = document.getElementById('tarea'); inc += 10; bar.scrollTop = inc; document.getElementById("write").innerHTML = inc; } function move_up() { bar = document.getElementById('tarea'); inc -= 10; bar.scrollTop = inc; document.getElementById("write").innerHTML = inc; } setInterval( function() { if(inc>=450) {move_up();} if(inc<450) {move_down();} } ,100); </script> <body> This is a code that will help in running data in the same loation, vertically <br> <br> <textarea rows="10" cols="20" id="tarea"> this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text </textarea> <br><br> <button onclick="movedown()" id="tarea">Click here</button><br> <div id="write"></div> </body> </html> I am trying to make a auto scroll function in java script, however, I am unable to do it, can you help with the code and tell what is wrong with the code ....................
-
I am trying to code something in Java-script, I am trying to "fade_in" image and "fade_out" image with Set_interval function, I am facing problem, help me @@@@@ <html> <script type="text/javascript"> var inc_bit =1e-2; function inc_change() { var s = document.getElementById('img'); document.getElementById('write').innerHTML = inc_bit; inc_bit = inc_bit + 1e-2; s.style.opacity = inc_bit; if(inc_bit>1e0) { setInterval(function() {dec_change();},100); } } function dec_change() { var s = document.getElementById('img'); document.getElementById('write').innerHTML = inc_bit; inc_bit = inc_bit - 1e-2; s.style.opacity = inc_bit; if(inc_bit<1e-2) { setInterval(function() {inc_change();},100); } } setInterval(function() {inc_change();},90); </script> <body onload="inc_change()"> <img src="pic1.jpg" height="200px" width="250px" id="img" style="opacity:0.0"/> <div id='write'></div> </body> </html>
- 3 replies
-
- javascript
- html
-
(and 1 more)
Tagged with:
-
An invoice will be opened in a new window when the Generate invoice button is clicked. Below is the sample code. For Example <form name="invoice" action="inv_rec.php" method="post" id="inv" target="invoices" onsubmit="return check_counter();" > <table> <tr> <td> <label for="cusname"><strong>Customer Name* </strong></label> <input type="text" size="20" name ="cusname" value="" id="Customername" required/> </td> <td> <label for="for_place"><strong>Place</strong></label> <input type="text" size="20" name ="for_place" value="" id="for_place" /> </td> </tr> ........ <tr> <td> <input type="submit" value="Generate Invoice" name="submit" id="sub"> </td> </tr> </table> </form> <script> var counter = 1; function check_counter() { if(counter == 1) { alert("Please enter the product details"); return false; } window.open('', 'invoices', 'width=650,height=800,status=yes,resizable=yes,scrollbars=yes'); return true; } </script> In my example the page will be redirected to inv_rec.php(opens in new window) which contains dynamically generated data obtained from mysql where the user needs to take the print of it. I want to clear all the form data which is open in the previous window(where the invoice form is displayed,i.e user fills the data to generate a invoice).Any help is appreciated.
- 6 replies
-
- javascript
- php
-
(and 1 more)
Tagged with: