Jump to content

dzhax

Members
  • Posts

    363
  • Joined

  • Last visited

Everything posted by dzhax

  1. Thanks Ingolme that is working much better. didn't know you can call a function like that. speaking about the handleResponse call.
  2. I have a process that runs every 30 seconds and i want my script to check if it is finished. this way my user doesn't have to wait an arbitrary 30 seconds if the request is submitted closer to the 30 second mark (5 seconds to process instead of the max 30). I tried a while loop and sending $.post within it but from my console logging it doesn't appear to process the while loop as intended var iii = 1; while(iii < 30){ console.log("Checking rcon queue for " + characterID + " (" + iii + ")"); //Code to wait 1 second before continuing. var start = new Date().getTime(); var end = start; while(end < start + 1000) { end = new Date().getTime(); } //Code to $.post to check the the queue is cleared $.post('scripts/rcon_queue.php', {cID: characterID}, function(response){ if(response == "1"){ console.log("Queue is not cleared."); } else { console.log("Queue is clear."); iii = 30; } }); iii++; } console.log("Loading info for character: " + characterID); Now i would expect this to end the while loop response is anything but "1". Which happened after 7 attempts in my most recent test. But this is not happening:
  3. Ok bare with me because I have no idea what this is actually called. If someone knows I will update the title. I am working on a site that will act as an out-of-game marketplace for in-game items. I want to ensure that the player is within the zone of the market in-game so I need an easy way to generate an array of valid coordinates the player could be within to access the market. Ideally i would like to run a function with a parameter specifying the radius of a square and another of the player's current geoID. Basic geometry would help if the geoID's were, in my mind, easier to predict. here is problem: Going North: geoID's increase by 512 points Going East: geoID's increase by 1 Going South: geoID's decrease by 512 Going West geoID's decrease by 1 I realize this is more of a math question then PHP but I have no idea where to start to account for the odd increase. //Generate the exchangeArea array of a 5x5 square around the centeral id specified in param2. $exchangeArea = getExchangeArea(3,117053149); //if player geoID equals one of the values in the exchangeArea array return true else false function getExchangeArea(int radius, int geoID) { . . . } I have attached a graphic showing all the geoIDs for the above example. Ignore the geoAlt that is just they players Y axis. So there is no confusion, North on this diagram is the right side of the image. Making the top West. Any help on where to begin, even if its helping me identify keywords to search on for this kind of formula, algorithm, equation... what ever it's called, would be greatly appreciated.
  4. Ok I got it working. after changing tmpJSON to response. and parsing the JSON outside of the filter var destringify = JSON.parse(staticJSON); $.each(destringify, function(i, v) { rather than $(JSON.parse(staticJSON)).filter(function (i, n){ Not sure why this was a thing but it works and that's all that matters right now.
  5. i am destringifying it tmpJson = $(JSON.parse(staticJSON)).filter(function (i, n){
  6. I think I am getting somewhere but the filter is not actually working var tmp, tmpJSON, response; var staticJSON = JSON.stringify( [{ "id": 35, "commentText": "Hello World.", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-07-29T18:36:39.044Z", "updatedAt": "2016-07-29T18:36:39.044Z" }, { "id": 36, "commentText": "This is all starting to come together", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:13:54.538Z", "updatedAt": "2016-07-29T19:13:54.538Z" }, { "id": 37, "commentText": "I'm pretending to be Lou", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-07-29T19:14:41.130Z", "updatedAt": "2016-07-29T19:14:41.130Z" }, { "id": 41, "commentText": "testing 123", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:21:35.637Z", "updatedAt": "2016-07-29T19:21:35.637Z" }, { "id": 42, "commentText": "testing123456", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:22:42.516Z", "updatedAt": "2016-07-29T19:22:42.516Z" }, { "id": 44, "commentText": "This is not important", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:33:54.805Z", "updatedAt": "2016-07-29T19:33:54.805Z" }, { "id": 51, "commentText": "New functionality", "createdBy": "Lou", "isImportant": true, "createdAt": "2016-08-03T14:38:54.724Z", "updatedAt": "2016-08-11T21:16:05.261Z" }, { "id": 92, "commentText": "Another test", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-08-11T22:18:06.022Z", "updatedAt": "2016-08-11T22:18:06.022Z" }, { "id": 29, "commentText": "hot garbage 2.0", "createdBy": "Kevin", "isImportant": true, "createdAt": "2016-07-28T21:59:35.145Z", "updatedAt": "2016-08-04T21:41:16.361Z" }, { "id": 54, "commentText": "please work", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-04T23:24:02.682Z", "updatedAt": "2016-08-04T23:24:02.682Z" }, { "id": 93, "commentText": "test comment", "createdBy": "mark", "isImportant": false, "createdAt": "2016-08-11T22:32:00.067Z", "updatedAt": "2016-08-11T22:32:00.067Z" }, { "id": 78, "commentText": "Testing modal dialog", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-08-10T01:22:10.015Z", "updatedAt": "2016-08-10T01:22:10.015Z" }, { "id": 94, "commentText": "test comment", "createdBy": "mark", "isImportant": true, "createdAt": "2016-08-11T22:32:24.534Z", "updatedAt": "2016-08-11T22:32:24.534Z" }, { "id": 61, "commentText": "wooo", "createdBy": "yes", "isImportant": false, "createdAt": "2016-08-09T22:04:42.671Z", "updatedAt": "2016-08-11T15:51:51.448Z" }, { "id": 81, "commentText": "Deleted files. Just checking if it still works", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-08-11T19:26:36.869Z", "updatedAt": "2016-08-11T19:26:36.869Z" }, { "id": 83, "commentText": "Trying it again", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-08-11T20:29:41.439Z", "updatedAt": "2016-08-11T20:29:41.439Z" }, { "id": 107, "commentText": "New!", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-11T23:03:50.597Z", "updatedAt": "2016-08-11T23:03:50.597Z" }, { "id": 112, "commentText": "One more time", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-11T23:23:49.398Z", "updatedAt": "2016-08-11T23:23:49.398Z" }, { "id": 115, "commentText": "Try this", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-11T23:32:54.382Z", "updatedAt": "2016-08-11T23:32:54.382Z" }] ); console.log(staticJSON); console.log(" "); console.log(" "); console.log(" "); console.log(" "); tmpJson = $(JSON.parse(staticJSON)).filter(function (i, n){ return n.isimportant !== false; }); tmp = "["; $.each(tmpJson, function(i) { tmp += '{'; tmp += '"commentText": "' + tmpJson[i].commentText + '", '; tmp += '"createdAt": "' + tmpJson[i].createdAt + '", '; tmp += '"createdBy": "' + tmpJson[i].createdBy + '", '; tmp += '"id": ' + tmpJson[i].id + ', '; tmp += '"isImportant": ' + tmpJson[i].isImportant + ', '; tmp += '"updatedAt": "' + tmpJson[i].updatedAt + '"'; tmp += '},'; }); tmp = tmp.substring(0, tmp.length - 1); tmp += ']'; console.log(tmp); response = tmp; Sorry for changing up the array but this is live code I am trying to work with. Console Log [{ "id": 35, "commentText": "Hello World.", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-07-29T18:36:39.044Z", "updatedAt": "2016-07-29T18:36:39.044Z" }, { "id": 36, "commentText": "This is all starting to come together", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:13:54.538Z", "updatedAt": "2016-07-29T19:13:54.538Z" }, { "id": 37, "commentText": "I'm pretending to be Lou", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-07-29T19:14:41.130Z", "updatedAt": "2016-07-29T19:14:41.130Z" }, { "id": 41, "commentText": "testing 123", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:21:35.637Z", "updatedAt": "2016-07-29T19:21:35.637Z" }, { "id": 42, "commentText": "testing123456", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:22:42.516Z", "updatedAt": "2016-07-29T19:22:42.516Z" }, { "id": 44, "commentText": "This is not important", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-07-29T19:33:54.805Z", "updatedAt": "2016-07-29T19:33:54.805Z" }, { "id": 51, "commentText": "New functionality", "createdBy": "Lou", "isImportant": true, "createdAt": "2016-08-03T14:38:54.724Z", "updatedAt": "2016-08-11T21:16:05.261Z" }, { "id": 92, "commentText": "Another test", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-08-11T22:18:06.022Z", "updatedAt": "2016-08-11T22:18:06.022Z" }, { "id": 29, "commentText": "hot garbage 2.0", "createdBy": "Kevin", "isImportant": true, "createdAt": "2016-07-28T21:59:35.145Z", "updatedAt": "2016-08-04T21:41:16.361Z" }, { "id": 54, "commentText": "please work", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-04T23:24:02.682Z", "updatedAt": "2016-08-04T23:24:02.682Z" }, { "id": 93, "commentText": "test comment", "createdBy": "mark", "isImportant": false, "createdAt": "2016-08-11T22:32:00.067Z", "updatedAt": "2016-08-11T22:32:00.067Z" }, { "id": 78, "commentText": "Testing modal dialog", "createdBy": "Lou", "isImportant": false, "createdAt": "2016-08-10T01:22:10.015Z", "updatedAt": "2016-08-10T01:22:10.015Z" }, { "id": 94, "commentText": "test comment", "createdBy": "mark", "isImportant": true, "createdAt": "2016-08-11T22:32:24.534Z", "updatedAt": "2016-08-11T22:32:24.534Z" }, { "id": 61, "commentText": "wooo", "createdBy": "yes", "isImportant": false, "createdAt": "2016-08-09T22:04:42.671Z", "updatedAt": "2016-08-11T15:51:51.448Z" }, { "id": 81, "commentText": "Deleted files. Just checking if it still works", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-08-11T19:26:36.869Z", "updatedAt": "2016-08-11T19:26:36.869Z" }, { "id": 83, "commentText": "Trying it again", "createdBy": "Mark", "isImportant": false, "createdAt": "2016-08-11T20:29:41.439Z", "updatedAt": "2016-08-11T20:29:41.439Z" }, { "id": 107, "commentText": "New!", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-11T23:03:50.597Z", "updatedAt": "2016-08-11T23:03:50.597Z" }, { "id": 112, "commentText": "One more time", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-11T23:23:49.398Z", "updatedAt": "2016-08-11T23:23:49.398Z" }, { "id": 115, "commentText": "Try this", "createdBy": "Dana", "isImportant": false, "createdAt": "2016-08-11T23:32:54.382Z", "updatedAt": "2016-08-11T23:32:54.382Z" }] [{ "commentText": "Hello World.", "createdAt": "2016-07-29T18:36:39.044Z", "createdBy": "Lou", "id": 35, "isImportant": false, "updatedAt": "2016-07-29T18:36:39.044Z" }, { "commentText": "This is all starting to come together", "createdAt": "2016-07-29T19:13:54.538Z", "createdBy": "Mark", "id": 36, "isImportant": false, "updatedAt": "2016-07-29T19:13:54.538Z" }, { "commentText": "I'm pretending to be Lou", "createdAt": "2016-07-29T19:14:41.130Z", "createdBy": "Lou", "id": 37, "isImportant": false, "updatedAt": "2016-07-29T19:14:41.130Z" }, { "commentText": "testing 123", "createdAt": "2016-07-29T19:21:35.637Z", "createdBy": "Mark", "id": 41, "isImportant": false, "updatedAt": "2016-07-29T19:21:35.637Z" }, { "commentText": "testing123456", "createdAt": "2016-07-29T19:22:42.516Z", "createdBy": "Mark", "id": 42, "isImportant": false, "updatedAt": "2016-07-29T19:22:42.516Z" }, { "commentText": "This is not important", "createdAt": "2016-07-29T19:33:54.805Z", "createdBy": "Mark", "id": 44, "isImportant": false, "updatedAt": "2016-07-29T19:33:54.805Z" }, { "commentText": "New functionality", "createdAt": "2016-08-03T14:38:54.724Z", "createdBy": "Lou", "id": 51, "isImportant": true, "updatedAt": "2016-08-11T21:16:05.261Z" }, { "commentText": "Another test", "createdAt": "2016-08-11T22:18:06.022Z", "createdBy": "Lou", "id": 92, "isImportant": false, "updatedAt": "2016-08-11T22:18:06.022Z" }, { "commentText": "hot garbage 2.0", "createdAt": "2016-07-28T21:59:35.145Z", "createdBy": "Kevin", "id": 29, "isImportant": true, "updatedAt": "2016-08-04T21:41:16.361Z" }, { "commentText": "please work", "createdAt": "2016-08-04T23:24:02.682Z", "createdBy": "Dana", "id": 54, "isImportant": false, "updatedAt": "2016-08-04T23:24:02.682Z" }, { "commentText": "test comment", "createdAt": "2016-08-11T22:32:00.067Z", "createdBy": "mark", "id": 93, "isImportant": false, "updatedAt": "2016-08-11T22:32:00.067Z" }, { "commentText": "Testing modal dialog", "createdAt": "2016-08-10T01:22:10.015Z", "createdBy": "Lou", "id": 78, "isImportant": false, "updatedAt": "2016-08-10T01:22:10.015Z" }, { "commentText": "test comment", "createdAt": "2016-08-11T22:32:24.534Z", "createdBy": "mark", "id": 94, "isImportant": true, "updatedAt": "2016-08-11T22:32:24.534Z" }, { "commentText": "wooo", "createdAt": "2016-08-09T22:04:42.671Z", "createdBy": "yes", "id": 61, "isImportant": false, "updatedAt": "2016-08-11T15:51:51.448Z" }, { "commentText": "Deleted files. Just checking if it still works", "createdAt": "2016-08-11T19:26:36.869Z", "createdBy": "Mark", "id": 81, "isImportant": false, "updatedAt": "2016-08-11T19:26:36.869Z" }, { "commentText": "Trying it again", "createdAt": "2016-08-11T20:29:41.439Z", "createdBy": "Mark", "id": 83, "isImportant": false, "updatedAt": "2016-08-11T20:29:41.439Z" }, { "commentText": "New!", "createdAt": "2016-08-11T23:03:50.597Z", "createdBy": "Dana", "id": 107, "isImportant": false, "updatedAt": "2016-08-11T23:03:50.597Z" }, { "commentText": "One more time", "createdAt": "2016-08-11T23:23:49.398Z", "createdBy": "Dana", "id": 112, "isImportant": false, "updatedAt": "2016-08-11T23:23:49.398Z" }, { "commentText": "Try this", "createdAt": "2016-08-11T23:32:54.382Z", "createdBy": "Dana", "id": 115, "isImportant": false, "updatedAt": "2016-08-11T23:32:54.382Z" }]
  7. What I want to do is rebuild the jsonSample filtering out the isImportant false. So what is returned is: [ { "id":1, "commentText":"Hello World", "createdBy":"User2", "isImportant":true }, { "id":3, "commentText":"This is another one", "createdBy":"User2", "isImportant":true }, { "id":4, "commentText":"Hello World!", "createdBy":"User2", "isImportant":true } ]
  8. Hello All, I am stuck trying to filter results of a json response. I have a sample json response: [ { "id":0, "commentText":"Test", "createdBy":"User1", "isImportant":false }, { "id":1, "commentText":"Hello World", "createdBy":"User2", "isImportant":true }, { "id":2, "commentText":"Testing", "createdBy":"User2", "isImportant":false }, { "id":3, "commentText":"This is another one", "createdBy":"User2", "isImportant":true }, { "id":4, "commentText":"Hello World!", "createdBy":"User2", "isImportant":true } ] I am attempting to filter out results that "isImportant" are not true. I have tried multiple ways of doing it with no luck. IE. var response = $(jsonSample).filter(function (i,n){ return n.isImportant===true }); var response2 = $.grep(Object(jsonSample), function(j){ return j.isImportant !== false; }); var response3 = $.map(jsonSample, function (n,i){ $.each(n, function(j){ return n.isImportant !== false; }) }); console.log(response); //jquery-2.2.4.min.js:2 Uncaught Error: Syntax error, unrecognized expression: ... console.log(response2); //logs every individual character in the jsonSample ["[", "{", """, "i", "d", """, ":", "1", ... console.log(response3); //jquery-2.2.4.min.js:2 Uncaught TypeError: Cannot use 'in' operator to search for 'length' in ...
  9. that's what i figured. but the error log begs to differ.
  10. Hello All,I am working on a new project and getting an error that is driving me nuts.Error:PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /../example.php on Line 215Here is my code around that line count. require '../SourceQuery/SourceQuery.class.php'; define('SQ_SERVER_ADDR', 'localhost');define('SQ_SERVER_PORT', 27015);define('SQ_TIMEOUT', 3);define('SQ_ENGINE', SourceQuery :: SOURCE); $ServerQuery = new SourceQuery(); $ServerInfo = Array(); try{ $ServerQuery->Connect(SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE); $ServerInfo = $ServerQuery->GetInfo();} catch(Exception $e){ $Exception = $e;} $ServerQuery->Disconnect();if($ServerInfo['Players'] > 0){ $output = "Failed to restart server. The Server is not empty."; mail($from, "Response: Restart", $output, 'From: noreply@domain.name' . "rn" . 'Reply-To: noreply@domain.name' . "rn" . 'X-Mailer: PHP/' . phpversion());} else { restartServer(); $output = "Server has been restarted. It Should be up shortly."; mail($from, "Response: Restart", $output, 'From: noreply@domain.name' . "rn" . 'Reply-To: noreply@domain.name' . "rn" . 'X-Mailer: PHP/' . phpversion());}Throughout my search this issue seems to come up around the quotations being incorrectly used. Most help posts were PHP MySQL related and they were not putting quotes around their string values. This does not appear to be the case. At least from what I can gather.Any insight would be grateful.
  11. Update: I have been playing around in chrome with different css on elements I have added .navbar{ min-height:150px;}.navbar-brand{ vertical-align:bottom;}.navbar-brand>img{ display:inline-block;} I am not keen on defining the height of the navbar manually but it works for now. So now the navbar is taller than my image, the title is on the same line, and the title is bottom aligned. I am still unable to get the navbar links to move down. If anyone knows a dynamic way to set the height of the navbar, and if anyone knows how to move the right navbar links to the bottom of the re-sized navbar please throw me a bone. I just realized that changing the min-height of the navbar bleeds over the content below. This is so frustrating.
  12. you can also display: inline-block; to make them print on the same line.
  13. dzhax

    Rule @face font

    @font-face{ font-family:"Avenir-n; src: url('fonts/AEBL.ttf');}@font-face{ font-family:"Avenir;src: url('fonts/AEM.ttf');} That should work assuming your font files are not messed up. To be safe with browser compatibility, I normally use a service such as FontSquirrel to convert my fonts. Then I use css like Tezzo's first post and I have never had issues with it.
  14. #wrapper{ position:relative; max-width: 800px; min-width: 400px; margin-left: auto; margin-right: auto;} #top{ positon:absolute; top:0px; left:0px; right:0px; height:100px; background-color: green; line-height: 100px; text-align: center;} #left{ position:absolute; top:100px; left:0px; width: 150px; background-color: red; height: 800px;} #right{ position:absolute; top:100px; left:150px; right:0px; background-color: blue; height: 800px;} This works for me.
  15. Can you post some of the HTML that makes up the form so we can better assist with a CSS Solution?
  16. I am using the Modern Business Theme, I am trying to add an image to the Brand (top left) section of the page. The image is 128px tall. My problem is the navigation bar stays the same height as it is now and the image bleeds into the carousel below. Also the text from the title shows up below the image. I was hoping to have the image and the title on the same line, the title be aligned to the bottom of the nav, and the rest of the navigation links (menus and links on the right) also be bottom aligned. The Following is my Navigation HTML: <!-- Navigation --> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.php"> <img src="image/logo.png" alt="Logo" /> Site Title </a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Category 1 <b class="caret"></b></a> <ul class="dropdown-menu"> <li> <a href="#" target="_blank">Item 1</a> </li> <li> <a href="#" target="_blank">Item 2</a> </li> <li> <a href="#" target="_blank">Item 3</a> </li> <li> <a href="#" target="_blank">Item 4</a> </li> </ul> </li> <li> <a href="#">Search <span class="glyphicon glyphicon-search" aria-hidden="true"></span></a> </li> <li> <a href="#">Other Link</a> </li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container --> </nav> I have played around with adding some style tags to some of the elements but I am unable to accomplish my desired result. I got the title on the same line as the image by adding: ... style="display:inline-block;" to the image. I was able to make the navigation bar taller by manually defining a height in the nav tag, but I would prefer a dynamically changing height in case this image were to change size. I tried to add: vertical-align:bottom in multiple places to try and push the text to the bottom of the nav when I defined the height of the nav, but I was never able to get the text to change it's current alignment. Purely css changes are preferred as the template is perfect otherwise. I am pulling my hair out at this point. Any help is much appreciated.
  17. took a different approach at this. Letting the database handle the duplicate instead of php. added ON DUPLICATE KEY UPDATE to the INSERT INTO query. thanks for looking into it :Happy:
  18. ok i will give it a shot but it still doesn't explain why the error log is telling me the string is wrong when it was commented out.
  19. for the record line 72 and 73 were originally not commented out and it was still producing the same error log.
  20. OK so i am working on this click to tweet script and I am basically checking the database to make sure it doesn't already exist before inserting it into the database. I am getting the following error_log [29-Jun-2014 18:55:07] PHP Parse error: syntax error, unexpected T_STRING in /.../c2t/tweet.html on line 72 Here is the relative code: <? if(isset($_GET['tweet'])){ $string = urlencode($_GET['tweet']); $crc32 = crc32($string); $con = mysqli_connect("localhost","USER","PASSWORD","DATABASE"); if(!$con){ die('Database Unavailable'); } $query = "SELECT * FROM `redirect` WHERE `crc32` = '".$crc32."'); if ($result = $mysqli->query($query)) { $row_cnt = $result->num_rows; if($row_cnt > 0){ echo 'This Click 2 Tweet Already Exists!<br /><br />'; } else { //$query2 = "INSERT INTO `redirect` (`crc32`,`tweet`,`created-by`) VALUES ('".$crc32."','".$string."','".$_SERVER['REMOTE_ADDR']."')"; //$mysqli->query($query2); echo 'Here is your Click 2 Tweet. Enjoy!<br /><br />'; } $result->close(); } } echo 'http://c2t.co/'.$crc32;?> Any help would be greatly appreciated.
  21. oh i think i got it. I didn't realize it was looking for an array (not sure why i didn't think of that) I added var json = jQuery.parseJSON(data); the changed data.channels to json.channels. now it seems to work.
  22. data is the json that gets returned.
  23. Hello All! It's been a while. Trying to parse a json string and running into some issues. <script type="text/javascript"> $().ready(function(){ var $_GET = {}; document.location.search.replace(/??(?[^=]+)=([^&]*)&?)/g, function () { function decode(s) { return decodeURIComponent(s.split("+").join(" ")); } $_GET[decode(arguments[1])] = decode(arguments[2]); }); //console.log($_GET["t"]); $.get("assets/php/all_channels.php?t="+$_GET["t"],function(data){/* START TROUBLE CODE*/ $.each(data.channels, function(i,object){ $.each(object, function(property, value) { console.log(property + "=" + value); }); });/* END TROUBLE CODE*/ }); });</script> In my chrome console I get the following: Uncaught TypeError: Cannot read property 'length' of undefined I have tracked the issue down to my .each code because commenting it out eliminates the error. I have added comments to surround the troublesome code. Any assistance with this issue is much appreciated.
  24. dzhax

    Finding the min value

    yes for the sake of an example $perCost = 0.016 $minPurchase = 0.2 Although both of these variable may change. I need to determine how many full units must be purchased in order to meet the minPurchase limit.
×
×
  • Create New...