johnboyman
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Where to put jsBasically Im making a wp site. I put my js functions into the functions.phph file. When i deploy the site, all of the functions are just put directly onto the wp page source code so that anyone can view it with a browser and steal it. Is there any way to hide this js code. Can I hide it in a . js file and then include that code onto my site another way without people being able to steal my code of the internet?
Forum: Fixing WordPress
In reply to: php session variables dont stick.never mind i fixed it thanks guys
Forum: Fixing WordPress
In reply to: how to add js functions to functions.phpi think i should say my question again how do i put javascript functions in the functions.php file and have then accessable on all of my pages thanks.
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressacutallty i figured it out thanks
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressoh no i made, that login.php file my self and put it next to admin-ajax.php
I just wanted to basically call a php file from ajax in wordpress but it wont work, and i tried admin-ajax.php
wihch workds except i dont wana put my login code there, i checked permissions theres no differenceanything else thanks?
Forum: Fixing WordPress
In reply to: How to use ajax in wordpresseven if i put the login.php right next to the admin-ajax.php file
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressexcuse me how come when i do this
var username=”johnboyman”
var password=”french”;
$.ajax({
type: “POST”,
url: “https://www.mysite.ca/wordpress/wp-admin/admin-ajax.php”,
data: “name=”+username+”&password=”+password,
success: function(html){if(html==’true’) {
$(“#add_err”).html(“right username or password”);}
else {
$(“#add_err”).css(‘display’, ‘inline’, ‘important’);
$(“#add_err”).html(“<img src=’images/alert.png’ />Wrong username or password”);
}
},
beforeSend:function()
{
$(“#add_err”).css(‘display’, ‘inline’, ‘important’);
$(“#add_err”).html(“<img src=’images/ajax-loader.gif’ /> Loading…”)
}
});
return false;it works but when I do
var username=”johnboyman”
var password=”french”;
$.ajax({
type: “POST”,
url: “https://www.mysite.ca/wordpress/wp-admin/login.php”,
data: “name=”+username+”&password=”+password,
success: function(html){if(html==’true’) {
$(“#add_err”).html(“right username or password”);}
else {
$(“#add_err”).css(‘display’, ‘inline’, ‘important’);
$(“#add_err”).html(“<img src=’images/alert.png’ />Wrong username or password”);
}
},
beforeSend:function()
{
$(“#add_err”).css(‘display’, ‘inline’, ‘important’);
$(“#add_err”).html(“<img src=’images/ajax-loader.gif’ /> Loading…”)
}
});
return false;it doesnt work
i can only use this ajax query on admin-ajax.php and no other files
why is that, i am trying to query login and sign in scripts how do i make this work. thanks
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressworked thanks alot. love ya
Forum: Fixing WordPress
In reply to: How to use ajax in wordpresscan i put this code on any page and in the php tags like this
[insert_php]
[/insert_php]
i use them with a php plugin to support php
I dont understand why are you php tags upside down
add_action(‘wp_footer’, ‘add_my_js’);
function add_my_js() {
?>
<script type=”text/javascript”>// your inline scripts go here</script>
<?php
}is add_action(‘wp_footer’, ‘add_my_js’); php?
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressis wp_footer for php? or js
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressNo i had a button hooked up to it, but i usd the code above to prove that jquery is working fine. Where is wp_footer hook can you show me how to use it with my js functions in my footer.php
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressstill doesn’t work.
the
$(document).ready(function(){works
anything else thanks.
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressnot working still ,thanks
Forum: Fixing WordPress
In reply to: How to use ajax in wordpressHello. I don’t know if its queued
I just added it like this to one of my pages. I can use j query fine anywhere on any page on my site.
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script>
I put my java script functions in my footer.php file. That is where the function where i call my Ajax query in at. Jquery works well. I tried what you said in my footer.php it looks like this
[insert_php]
add_action(‘wp_enqueue_scripts’, ‘enqueue_jquery_min’);
function enqueue_jquery_min() {wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, “//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”, false, null);
wp_enqueue_script(‘jquery’);}
[/insert_php]
<script type=”text/javascript”>
$(document).ready(function(){
$.ajax({
url: “https://www.google.com”,
success: function( data ) {
alert( ‘hi!’);
}
});});
</script>
Forum: Fixing WordPress
In reply to: Javascript and jquery code doesnt take effect oftenHi i think i figured it out. I put my jquery code in the footer.php file right before the </body> tags Now i am no longer having these problems. Does this sound about right?
I dont have a page to show you because my code keeps changing and i try to figure out why my jquery code wasnt taking effect all the time.