Pavlos1316
Members-
Posts
302 -
Joined
-
Last visited
Everything posted by Pavlos1316
-
hi, which is better to use for my internal linked pages: www.example.com/my-test-subject1 or www.example.com/subject1 If someone makes a search for subject1 will both appear or...?
-
I have the below code to open contents in a div or modal window and at the same time showing the url that matches the specified page which works as expected, no problems rising: $(document).ready(function(){ ///////LINK in a Div//////// $('#all').delegate('a.img-lnk, a.txt-lnk', 'click', function(){ $('#main').empty(); var page = $(this).attr('id'); var pageurl = $(this).attr('data-seo'); $('#main').load("../"+ page + ".php"); window.history.pushState('','',pageurl); }); ///////LINK in a Modal Window//////// $('#all').delegate('a.pop-lnk', 'click', function(){ var poppage = $(this).attr('id'); var popurl = $(this).attr('data-seo'); $('#popup').load("../char-inf/"+ poppage + ".php"); window.history.pushState('','',"/char-inf/"+ popurl); }); $('body').delegate('.hide-it', 'click', function(){ $('.hide-it').hide(); $('#popup').empty(); window.history.back(); }); }); Problem: If I give you a url of a link in my page e.g. www.example.com/test1 and paste it in your browser the test1 page will open normally, BUT after that if you navigate to page test2 then the new url becomes www.example.com/test1/test2. Is there a way to turn the url at its normal state which would be www.example.com/test2?
-
Thank you very much... I wasn't aware for the data- tag and seems very helpful.
-
In HTML5 some attributes are no longer supported eg: name attr for <a> is no longer supported. What happens when in a tag like <a> exists a non supported attr? <a id="me" name="you"> Will it just be ignored like is not there or it can cause problems later on and how?
-
Change url using window.history.pushState
Pavlos1316 replied to Pavlos1316's topic in Javascript Help
I just had not to use the '' when using the variable. window.history.pushState('','',page); -
Thank you
-
Is there a way to change the url in the code below using window.history.pushState dynamically to match the "page" variable? $(document).ready(function(){ $('#all').delegate('a.pop-lnk', 'click', function(){ var page = $(this).attr('id'); $('#popup').load("../folder/"+ page + ".php"); window.history.pushState('','','/page'); }); });
-
I have couple jquery codes in a single file: $(document).ready(function(){ $('#all').delegate('a.link', 'click', function(){ //more code here }) $('body').delegate('.nice', 'click', function(){ //more code here }) }); This works great but is it better to close each function using ; symbol? Even if I do or not the code works ok, BUT whats the correct way?
-
I am stupid I was trying your answer the last hour... Forgot to add the full path ../help-file/ that's why it wasn't working Now that I saw it written by you I realized!!! Thank you by the way... I will mark it as best answer.
-
loop.php does nothing important. just checking if page exists but that is carried out by the server. I have eg 2 links: <a id="test1" class="pop-lnk"> <a id="test2" class="pop-lnk"> By clicking the link I use my JQ code to open the information of test1.php in a modal window. But the loop.php takes the IDvalue from my <a> and adds the .php extension so JQ can load the file. Can JQ add the .php extension so I skip loop.php?
-
I am using this to open contents into a modal window, but in the process I am passing it through loop.php to check if the page exists and then load. Is there a way to completely skip the loop.php file and load my clicked link? $(document).ready(function(){ ///////LINK in a Modal Window//////// $('#all').delegate('a.pop-lnk', 'click', function(){ var page = $(this).attr('id'); $('#gr-out').css({ opacity: 0.7, 'width':$(document).width(),'height':$(document).height()}).show(); $('#popup').css({'display': 'block'}); $('#popup').load("../help-file/loop.php?page="+ page); }); }); The id attr I am getting from this code is my page's name but I need to add the .php extension if is possible so I can load the page.
-
I use this code to open the contents of my Menu Links inside my <div id="main"> so I do not need to reload the whole page each time: .delegate('a.difflink', 'click', function(){ $('#content').empty(); var page = $(this).attr('id'); $('#content').load("page_scripts/loop_a.php?page="+ page); Problem created is that by using the above method my browser's address bar always shows www.myXample.com so I cannot create sitemap for SEO. And as I understood (not sure if I am correct) the way I made it work is like there are no new urls to show (since I am just changing div content). QUESTION: Is there a way to make my page work as it should e.g when I press "Downloads" --- address will show: www.myXample.com/downloads and still no need to reload the whole page? A solution would be to use this in my code: window.history.pushState('','','/downloads'); it changes the url to the desired BUT if I manually enter on my browser www.myXample.com/downloads I get just the contents of the div without any page formatting or menus, which is natural result. So is there a work around to achieve my goal or is it one of two: Reloading the whole page Vs No reloading and no URLs for SEO.
-
This is my downloading script: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <?php // block any attempt to the filesystem if (isset($_GET['file']) && basename($_GET['file']) == $_GET['file']) { $filename = $_GET['file']; } else { $filename = NULL; } $err = '<p>ERROR</p>'; if (!$filename) { // if variable $filename is NULL or false display the message echo $err; } else { // define the path to your download folder plus assign the file name $path = '../downloads/'.$filename; // check that file exists and is readable if (file_exists($path) && is_readable($path)) { // get the file size and send the http headers $size = filesize($path); header('Content-Type: application/octet-stream;'); header('Content-Length: '.$size); header('Content-Disposition: attachment; filename='.$filename); header('Content-Transfer-Encoding: binary'); // open the file in binary read-only mode // display the error messages if the file canĀ“t be opened $file = @ fopen($path, 'rb'); if ($file) { // stream the file and exit the script when complete fpassthru($file); exit; } else { echo $err; } } else { echo $err; } } ?> </body> </html> and this is how I call it: <a href="script/download.php?file=File_Name.doc" class="dload">03. File Name</a> If I have the name in English everything is ok. If I change it to greek, I get the ERROR msg! I need it in Greek. Any suggestions?
-
I will do it later... Where I am now the firewall doesn't give me access to my server...
-
I cannot understand... All my other pages are working...
-
e.g. css: .txt { color: #f0f; } and form: <form> <span class="txt"> Name <input /> </span> </form> My "Name" is not getting the css style=txt
-
Hello, I just assembly a form and for styling it I am using CSS in an external file. Problem is that IE8 and I don't know about 7 (in IE9 is ok) it doesn't show the styling inside the form... My structure is something like this: (in any other situation my css styling is displayed normally) <form> <span class="myclass"> </span> </form> Is there any fix for it? Thank you
-
This is how I did it (trying): function validateEmail(){ //testing regular expression var a = $("#email").val(); $.ajax({ type: "GET", url: "is_email.php", data: "email="+a, success: function(response){ //if it's valid email if(is_email(a)){ email.removeClass("error"); emailInfo.text(""); emailInfo.removeClass("error"); return true; //if it's NOT valid }else{ email.addClass("error"); emailInfo.text("Please type a valid E-mail"); emailInfo.addClass("error"); return false; } } }); } But I get this error in firebug: is_email is not defined. How can I correct this? Thank you
-
Oh... You said form name at first and I was confused... My spelling I have checked it and it was ok... I am using the if(isset ($_POST['submit']))... I don't know.... If I wasn't submiting the form to the validation.php would I get my email send????
-
What do you mean by "your form name is spelled wrong"? Where? or your not submitting the form Hm... I am calling the php script using require_once('validate.php') at the top where my form is. I have my <form action=''> because I am using JQ validation as well. I don't know/think the mistake is here. My email is being sent even if it's empty...
-
Hello, I am trying to validate and insert some values into a db. Although I did this 3-4 times succesfully, I have a problem which I don't know where it came from. My validation code (partial): <?php //connect to db require_once('dbconnection.php'); $name = mysql_real_escape_string($_POST['name']); //LINE 3 function validateName($name){ //if it's NOT valid if(strlen($name) < 3){ return false; //if it's valid }else{ return true; } } $query = "INSERT INTO s_table (ID, Name) VALUES ('Null', '$name')"; mysql_query($query) or die(mysql_error()); mysql_close(); //Send email code ?> But I get: Undefined index: name in.... on line 3. (This is a Notice and not an ERROR but I prefer to get rid of it instead of disabling the Notices and "hide" it.) What am I doing wrong
-
will try this thanks
-
I am using this code for email validation: function validateEmail(){ var a = $("#email").val(); var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/; //if it's valid email if(filter.test(a)){ //do something return true; } else{ //do something else } Instead of using that filter I want use my email_validation.php file. How can I modify the code to do it Thank you
-
Hello, Below is a part of my validation function in jq... function{ if(str.val().length = 0){ //some code } else{ str.removeClass("aclass"); //more code } } In the first line I want to check if any of my fields is empty [e.g. f1 or f2 or f3 .val() empty)] and at the second line I want to remove the class from all of them again [e.g. f1 & f2 &f3 .removeClass] How to I write this in jq? Thank you
-
Display result without refreshing the page
Pavlos1316 replied to Pavlos1316's topic in Javascript Help
Can somebody answer my questions, please? (I think they are easy for those who understand how to use ajax) Thank you