Skip to content

Instantly share code, notes, and snippets.

@wilornel
wilornel / Regfunction
Created April 7, 2012 02:08
Some register function
//the Function:
// register.php is just: <?php echo "ok" ?>
function registerR(){
// alert ('works1');
var ajaxRequest3;
if (window.XMLHttpRequest)
{
// alert('works2');
ajaxRequest3 = new XMLHttpRequest();
@wilornel
wilornel / BadScript
Created April 7, 2012 05:10
Big js script
<script type="text/javascript">
var store_reguser;
var ajaxRequest;
function ajaxFunc()
{
if (window.XMLHttpRequest)
{//Code for IE7+, Firefox, Chrome, Opera, Safari
ajaxRequest=new XMLHttpRequest();
}
else
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript">
function button_actions() {
var errors = 0;
if (document.getElementById('fname').value == ""){
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript">
function button_actions() {
console.log('works');
if (document.getElementById('fname').value =='')
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript">
function button_actions() {
var errors = 0;
if (document.getElementById('fname').value == ""){
The problem is not here, it is at the file: loginFunc.js
making ajaxRequest worked
GET http://localhost/businessWebsite/ServerUsers.php?usernameID=b 200 OK 48ms loginFunc.js (line 57)
GET http://localhost/businessWebsite/ServerUsers.php?usernameID=bo 200 OK 37ms loginFunc.js (line 57)
GET http://localhost/businessWebsite/ServerUsers.php?usernameID=bob 200 OK 36ms loginFunc.js (line 57)
GET http://localhost/businessWebsite/checkLogin.php?username=bob&pass=asd Aborted loginFunc.js (line 88)
expecting some query?username=bob&pass=asd loginFunc.js (line 89)
function ajaxExecution(functionToExecute, link1)
{
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4)
{
functionToExecute;
}
}
var link_ = "link" +functionToExecute;
ajaxRequest.open("GET", link_, true);
<html>
<head>
<script type="text/javascript">
function executeAnother(theFunc){
// execute some other function
theFunc;
alert ('this: ' +working1()); // Here I am just testing the return of my other function
}
function working1(){
console.log('console.log works');
$('body').click(function(){
$('#searchbox').focus();
});
<script>
$(document).ready(function(){
$('body').keypress(function(){
event.preventDefault();
$('#input').focus();
});
$('#input').keypress(function(){
event.stopPropagation();
});
$('#input').keyup(function(){