Title: PHP AJAX REQ
Last modified: October 10, 2020

---

# PHP AJAX REQ

 *  Resolved [Unlimits](https://wordpress.org/support/users/felipexx85/)
 * (@felipexx85)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/php-ajax-req/)
 * PLEASE HOW TO
 *  $.ajax({ url: ‘formulario.php’,
    data: {action: ‘test’}, type: ‘post’, success:
   function(result){ $(“#box_button”).html(result); }
 * });
 * import my form from public html, how do i find diretory?
 * ive create a js file that requisite this form.php on public, or other folder…
   
   how do i execute ?

Viewing 1 replies (of 1 total)

 *  Plugin Author [SilkyPress](https://wordpress.org/support/users/diana_burduja/)
 * (@diana_burduja)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/php-ajax-req/#post-13518846)
 * There are a lot of things confused here.
 * For the beginning, as recommended in the editor’s comment on the “Add JS Code”
   page, you’ll need to wrap your JS code in
 *     ```
       jQuery(document).ready(function($) {
         \\ your code
       });
       ```
   
 * because of the jQuery noconflict mode used by default in WordPress (see [this article](https://stackoverflow.com/questions/24938890/wordpress-jquery-noconflict)).
 * Then, the “url” cannot simply be a PHP file in your public_html folder, but it
   has to be WordPress built in AJAX url: /wp-admin/admin-ajax.php (see [this article](https://shellcreeper.com/wp-ajax-for-beginners/)).
 * Afterwards you can write a function hooked in the “wp_ajax_test” and “wp_ajax_nopriv_test”
   WP actions where you can process the $_POST variable sent by your AJAX code. 
   The WP actions are called “wp_ajax_test” and “wp_ajax_nopriv_test” because you’ve
   set your “action” variable to “test”. They might also be called “wp_ajax_my_ajax_action”
   and “wp_ajax_nopriv_my_ajax_action” if you set your “action” variable to “my_ajax_action”.
 * If you have more questions, please consider asking them on stackoverflow. Your
   issue is not related to this plugin directly, but generally to your understanding
   of the WordPress AJAX principles.

Viewing 1 replies (of 1 total)

The topic ‘PHP AJAX REQ’ is closed to new replies.

 * ![](https://ps.w.org/custom-css-js/assets/icon-128x128.png?rev=1303730)
 * [Simple Custom CSS and JS](https://wordpress.org/plugins/custom-css-js/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-css-js/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-css-js/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-css-js/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-css-js/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-css-js/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [form](https://wordpress.org/support/topic-tag/form/)
 * [Import](https://wordpress.org/support/topic-tag/import/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 2 participants
 * Last reply from: [SilkyPress](https://wordpress.org/support/users/diana_burduja/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/php-ajax-req/#post-13518846)
 * Status: resolved