Jump to content

thescientist

Moderator
  • Posts

    8,682
  • Joined

  • Last visited

Everything posted by thescientist

  1. What do you mean? jQuery and ajax are Javascript, you're obviously using that. I'm not sure what the problem is that you're trying to solve. I'm confused too, because immediately afterwards this is said
  2. PHP is server side language http://php.net/ Zend Framework is a framework for developing PHP applications http://framework.zend.com/
  3. Maybe render was a bad term. If you are trying to use echo, and want JS to show values from PHP variables, then you would need to output the JS at the same time as a PHP script run. Or, as JSG suggested, you could use AJAX to request the value from a PHP script instead. That might work better for you in this situation given what you've presented so far.
  4. I am going to move this to the PHP forum. As you may or may not know, PHP executes before JS does (the browser only outputs what the server returns), so if you are looking to mix the two like this, you will need to render the JS with PHP.
  5. From you first post, you say your response is this {"location":"41.5200305, -88.20172930000001","address":"Shorewood, IL"} You only have an object, not an array. Array notation data[0].someProperty will return exactly what you are seeing, undefined
  6. I think the point your missing is that your so focused on validating the data that you're not focusing on whether or not the user actually has permissions to do what they are doing with that data. Since most applications care about interactions coming from the outside world, especially when user login / accounts are involved, things like SESSION, permissions, and user roles are created to make sure that, in this case, a person can only delete appointments from their _own_ calendar. If you all you pass is an appointment ID to the back end and just make sure it's an integer, what's to stop me from logging into your site with my own account, looking at the request in network tools, and recreating that request using something like cURL (or even just live editing IDs right on the page) to send a request with an arbitrary appointment ID that could belong to another user? Sure It may be an integer, but without authorizing my access to that appointment, you've basically created an environment where anything goes.
  7. Exactly my point. Requesting clarification for an issue you are bring forward for help with, shouldn't be treated with snarky replies. This was something I saw in your posts back when you were active, and it seems it's sill prevalent now. It's just an observation, but it is not how I usually engage with people I am asking help from. Both personally and professionally. Remember, participation on the forum is provided by users giving up their their _free_ time and expertise. I tend to respect that. I am a moderator of this forum if that's what you're trying to get at. Yes, because I have been on this forum for a few years now and I personally respect a lot of the help and support he provides here. I can't count the number of things I have learned from reading his posts. Also watching him interact with users of all skill levels on this forum is very enlightening as that is something that I have to deal with on a daily basis training and managing teams of developers of all skill levels. It reminds me to be humble myself because no one knows everything, and as such, I make sure to keep that in mind when I run into problems that I ask my colleagues about. To be clear, I'm not attacking, just observing and commenting. As a moderator it is part of my job to make sure discourse is fair and in line with the guidelines and netiqutte defined in the forum rules.
  8. Wow... well, best of luck of with getting help from others. I can only hope you treat them with a little more respect then you do / did those around here.
  9. Just break it down for each recommendation Use a class instead of IDs Move the event handler outside of the loop $rn = 0;while ($row = ...................) { $rn++; echo " <tr> <td>" . $row['abc'] . "</td> <td><a class='delete' href='delete.php?m=$m&abc=$row[abc]'>DELETE</a></td> </tr> ";}echo " <script> $(document).ready(function(e) { $('.delete').click(function(e) { var conf = confirm('Sure Delete!?') if (!conf) { event.preventDefault(); } }); }); </script>";
  10. Agreed. Outputting elements / HTML in a loop is a good idea, but attaching event handles in a loop like that is a bad idea. Use the loop to generate your HTML, and then outside the loop output your JS snippet for attaching events.
  11. thescientist

    Livesearch

    You'll have to provide more detail that. Where is it failing? I asked if you were checking for or getting any errors. How are you validating each step of your code works? What logging and debugging have you tried? Try and trace the code through each line and make sure you actually know what each line is doing and confirm that with logging. A couple things I see: 1. I wouldn't use a keyup event on the element in line and an event handler. I would just use the event handler 2. You are POSTing an object, and in your PHP are you looking for it as 's'. That doesn't line up at all with what you're sending
  12. what does the current object look like now?
  13. thescientist

    Livesearch

    what about it doesn't work? what do you want it to do that it isn't doing? Are you checking for or getting any errors?
  14. Map the element the error message should go to and make it dynamic instead of hardcoding it. This could be part of your validation object.
  15. As JSG referenced, a lot more teams these days are using virtualization tools to manage their environments to reproduce locally what is in production, or to even manage what's in production itself (if you have control over that environment). There is a growing trend for configuring and managing environments that easily supports just this kind of trial and error. Often you start with a base image, one that resembles (as closely as possible) the target (production) environment for your application. From there it is replicated and distributed to developers and into dev and / or staging environments. If you are on shared hosting and can't control those environments, at least you still emulate them with a higher degree of confidence to help minimize issues with your deployments. Then if you want to make changes, you can clone your base image and make changes and test them out. No work lost, and you will always have your base image. Then it's merely a matter of updating a config, rebuilding your image, and redistributing out to the team. Some tools that are of note are https://www.docker.com/ https://www.vagrantup.com/ https://puphpet.com/ https://www.chef.io/chef/ One of the main reasons I have been working on adding these to my personal project workflow is that it eliminates just such the issue you are seeing, where making changes to a _local_ environment is met with apprehension. With a virtualized work environment, the common denominator is handled for you, and you know any developer with any OS can run exactly what is production without having to mess with their local environment. In fact, developers can now have an image for multiple projects with differing environment requirements and not have to worry about maintaining their machines. edit: also, why the snark when people are just trying to glean more details from a question you posted soliciting advice / help?
  16. Don't think, know. Look at the documentation. https://developer.mozilla.org/en-US/docs/Web/API/Element.getElementsByTagName http://www.w3schools.com/jsref/met_document_getelementsbytagname.asp It returns a (array-like) collection. As in the W3Schools example, you have to loop through each element and do what you need to do that way.
  17. I would start with the tutorials at minimum http://www.w3schools.com/js/default.asp From there, the most likely topics you will then want to cover and master are DOM interaction Event binding / handling AJAX Prototypes and "classic" OOP design Libraries and Frameworks (jQuery, Angular, Backbone, etc) Build tools (Grunt, Gulp) / version control (Git, SVN)
  18. Please start a new thread for a new topic you want to bring up. Please do not post inside someone else's thread.
  19. Show us the code you have now that reflects the logging you have added in those additional places.
  20. Most importantly it seems is that the OP should not be relying on their editor to give rendering / preview feedback that they should be getting from a browser instead. It seems they are relying on the "magic" this editor is providing rather than the "real" runtime environment the browser provides. Forget what your editor is telling you, and focus instead on what the browser tells you. That is what the end user is going to be using anyway, might as well cut out the middleman.
  21. I would also add logging inside the function. I would do right on the first line and inside setTimeout.
  22. what's the context? i am not sure what you're asking for. Is this something related to the forums here? Something in a project you are working on?
  23. I'm not sure what the actual problem is. Please provide a code sample that clearly illustrates the problem with what is happening and describe what you want to happen
  24. You should be checking your browsers error console, Firefox has a good extension called Firebug (may be bundled by default now, not sure). The issue you are likely to see is that MyFunction doesn't exist, because in your code it's defined as myFunction (notice the casing difference). In Javascript, variable / function / etc names are case sensitive.
  25. Also, the request is made asynchronously. This alert alert(stored_houses[0].address) will fail as it will get executed immediately (and at best introduce as race condition), so you have to do all your work with the response data within the callback function instead (like you are already doing)
×
×
  • Create New...