Title: Using jQuery .load() function with wordpress and gravity forms
Last modified: August 21, 2016

---

# Using jQuery .load() function with wordpress and gravity forms

 *  [adrianlittee](https://wordpress.org/support/users/adrianlittee/)
 * (@adrianlittee)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/using-jquery-load-function-with-wordpress-and-gravity-forms/)
 * I am developing a series of pages which will integrate with Gravity Forms.
 * I’m using jQuery to send data to a div from a page I have created.
 * Requesting Page
 *     ```
       <a href="#" onclick="showEntry(\''.$url.'\')">View</a>
       <div id="viewEntry"></div>
       ```
   
 * Javascript/jQuery page
 *     ```
       function showEntry(url){
           jQuery(document).ready(function($){
               $('#viewEntry').load(url);
           });
       }
       ```
   
 * PHP data page – entry.php
 *     ```
       $form_id = $_GET['f'];
       $form = GFFormsModel::get_form_meta( $form_id );
   
       var_dump($form);
       ```
   
 * When ever I click run I get an error in my log file saying: PHP Fatal error: 
   Class ‘GFFormsModel’ not found in
 * I want to know how I can get the entry.php file recognizing all the classes in
   the rest of my WordPress file system.
 * Any help would be great!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Simalam](https://wordpress.org/support/users/simalam/)
 * (@simalam)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/using-jquery-load-function-with-wordpress-and-gravity-forms/#post-4650572)
 * You can use the following code at the top of your PHP file to have access to 
   WordPress classes
 * `include_once('path/to/wp-load.php' );`
 * You’ll have to change the path to actually point to where the wp-load.php file
   is actually located on your system.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/using-jquery-load-function-with-wordpress-and-gravity-forms/#post-4650609)
 * Simalam is correct, and this will work fine for your own site where you know 
   where your files are. If you want others to use your plugins on their sites, 
   it’s not possible to reliably know where wp-load.php lies on any random installation.
 * The only way for a php file to access WP resources and plugins on any system 
   is to make it a page template where the code is invoked by requesting a page 
   published based on the template.
 * There are a couple other ways to get requested PHP code to access WP resources.
   The code needs to be configured as an action callback in a plugin. That action
   is then triggered by sending requests either through wp-admin/admin-ajax.php 
   or admin-post.php. The first requires an AJAX request from jQuery, the latter
   accepts both GET and POST requests, no jQuery required.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using jQuery .load() function with wordpress and gravity forms’ is closed
to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/using-jquery-load-function-with-wordpress-and-gravity-forms/#post-4650609)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
