Results 1 to 4 of 4

Thread: Help Combining PHP and Jquery

  1. #1
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Help Combining PHP and Jquery

    I'm putting together a page that has both PHP and Jquery code. I can get the PHP code or the Jquery code to work, but not both. Before I post the code, I just want to know if I can have a page (.php) with PHP, Jquery and HTML code in it.

    Thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes, that's no problem. I suppose it could be done various ways. What I usually do is start with the HTML and jQuery, then add PHP. HTML and jQuery are relatively easy because they're more or less WYSIWYG. The HTML you can see in the browser. Any problems with jQuery should appear in the browser's console (F12 in most browsers). Once they're working, you will be substituting PHP for parts of the HTML and/or jQuery (or I suppose the PHP part can be separate, but I think you mean to use it as part of the other code). Once you add the PHP, you can use the browser's "View Source" to see how the PHP is being interpreted. Look at the "View Source" before you add the PHP. Use that as a reference as to how it should look. Between that and any PHP errors you see in the source view, you can troubleshoot the code if needed.

    BTW, you've already done this. That slideshow has PHP, jQuery and HTML on it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Short and sweet - Yes.

    Please post your code so we can help with the formatting/placement/structure (or whatever it is that is causing you problems)
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  4. #4
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    John.

    Thanks for the tips. Turns out that one of the jquery libraries wasn't loading correctly. Recopied it to the server and all works fine. Thanks.

    Jim

Similar Threads

  1. combining 2 resultsets
    By php_techy in forum MySQL and other databases
    Replies: 2
    Last Post: 06-11-2010, 01:13 PM
  2. Replies: 4
    Last Post: 05-30-2010, 02:30 PM
  3. combining 2 javascripts
    By emanuelle in forum JavaScript
    Replies: 0
    Last Post: 02-19-2009, 01:57 PM
  4. Combining Old with New
    By BLiZZaRD in forum Computer hardware and software
    Replies: 3
    Last Post: 11-18-2007, 03:36 PM
  5. Help combining Javascript
    By Jungleman in forum JavaScript
    Replies: 0
    Last Post: 07-06-2006, 01:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •