Been a while since i posted here so, hai again. This is weird to me, dont under stand it. I am new to Java and Ajax but PHP is my best friend. Basically, i have some Ajax that checks a PHP script and when done, the PHP Script will echo either 0 or 1 (success or fail).
Trying to validate a name... If it's in the database, return "exists" if it isn't return "newOne". I get "exists" or "newOne" back in my success function and set a variable (var ifExists) with that text, but when I try to do something based on whether ifExists = "newOne" or "exists", it always goes into the first part of the function...
jQuery:
var sendMenuName = "menuname="+menuname; $.ajax({ type: "post", async: false,
How would one go about comparing 2 strings one of which may contain special entities (eg "cassé" and "cassé")?
I tried to find a way to take the second string and do a replace whenever such entities are encountered but this implies creating some sort of lookup table containing not all but a good number of entity codes. Unless I am mistaken, javascript does not any function to replace an entity-infested string with a decoded string, pretty much like php's html_entity_decode. Another way, probably better (but I don't know), would be to encode the first string.
var choice = document.getElementById('choiceKey6').value; var searcher = document.getElementById('searchText').value; if (choice == "Services") { var script = '/site/includes/az_search_results.php';
[Code]...
choiceKey6 is a drop down menu with the values "Services", "Documents", "Downloads", "Frequently Asked Questions". I've named it strangely because of the bug that causes IE's getElementByID to search both ID's and names. SearchText is just a textbox, but it is irrelevant to my problem.
My problem is that in firefox this works as expected, the string comparisons work and the code in the if statements is executed as expected. In internet explorer however, the algorithm always defaults to the else statement at the end. What have I done wrong? argh.
I have a problem with Javascript, I need to do something fairly complicated and I'm not sure how. first let me explain what I am trying to do.
I need a user to be able to enter a single word in a text form on a page. i then need to seperate every character in that string to create new variables (example: var charater1 = string.charAt(0)) there are ten characters in total.
I then need to compare the character to find the appropriate integer number for it, for example A would equal the integer number 1. once I have converted all ten characters I then need to write them to a file, something like a text file or the like.
why the string comparison test doesn't work in this javascript function? It works if you use just text between the currentItem div tags, but not when you use html for an image. I even tried to use iso characters instead of angle brackets, as in "<img src=expand.png></img>" and still no dice. Why not?
I'm about to develop a heavily AJAX based website (this is because the website should look more like a brochure/leaflet). All of this should happen without harming it's SEO performance.I saw some solutions (but most articles were actually quite outdated).this is how I see it:
- One way to do it is by using a hash URL. something like www.website.com/#!/category/product
-- with jQuery you can make the hash change however you want
-- because of the '!', Google will ask for a HTML snapshot. Everyone is happy in that way.
-- Question: will these clean urls (so the /#!/... ones) have the same value for Google as the traditional ../category/product urls?
- Another way is to have standard links: like [url].....
-- Use 'Hijax' system, so catch the standard (server side urls) and get the content trough javascript httprequest
-- Google bot can just visit normal page instantly, for him this is just a normal site
-- Javascript disabled browsers will now be able to surf the website in a better way.
-- Only one page has to be created, and not 2 views as with the previous solution...
-- Question: I haven't seen how this is technically possible. So far I only saw /#/ websites.
What do you think about these 2 solutions? Which one is preferable? Do you have experience with one of them?
Edit: PS: it was difficult to choose in which section to put this topic (SEO or Javascript). But I guess there will be more javascript than SEO challenges in this development process.
I have this function that checks formfields with an onChange. But it seems to get my comparisons wrong. I've listed the function below, and give some sample values here, the committed value is changed from 1000 to 1500 and then gets a popup that it is greater than the Budget? Code:
I have three fields that I want validated on a form. Item3 cannot be smaller than Item2 and Item2 cannot be smaller than Item1.
Below is what I had in mind:
Function validateForm() { If (Item3 < Item2) alert="You must enter a bigger size for Item 3" else If (Item2 < Item1) alert="You must enter a bigger size for Item 2 } </script>
I have 2 textbox for Date input: Start Date and End Date I have javascript onsubmit="return fieldCheck()" to check all the required fields are not empty.
My problem is that i want to throw below javascript to check that End Date cannot be earlier than the Start Date. It works if both dates are in the same month, and if they are different month or day, then it's not working properly
d1 = new Date(d1_str.split('/')[2],d1_str.split('/')[1],d1_str.split('/')[0]); d2 = new Date(d2_str.split('/')[2],d2_str.split('/')[1],d2_str.split('/')[0]);
if (d1.getTime()<d2.getTime()) { emptyfields += " End Date can't be earlier than Start Date" ; //this is the error msg }
Can anyone sort out my problem.I want to build a product comparison page in javascript with checkbox i.e when a user click on the respective checkbox with images maybe 1 or more, then the comparison table should show on the same page.I am having about 10 products and 12 comparison categories to be compared.The user can check one checkbox or all....
Have a question regarding the comparison function on the At & t website URL...The site allows you to select different types of phones then generate a comparison chart based on your selection. I need to construct a similar comparison chart, but have no idea how to start the coding process.
I'm trying to post some xml to the server via ajax that contains utf characters. (�, �, etc...)
IE presented no problems, but firefox insists on mangling the chars.
Here's what I'm currently trying. code...
If I look at what is posted using the tamperdata plug in I can see that the charset specified in the header is utf-8. But the chars in the posted data are garbled.
I am using ajax to pass php variable to javasccript function as shown below for my particular application.
i am using the foolowing function from ajax.js freely available from net to implement the ajax functionality as
var abc = new sack(); PHP portion which passes the response text: ************************************ <? $table=$_GET['tablename'];
[Code]....
1] When $table is having a string with only numeric characters for eg: "123" we get the alert
2] When $table is having a string with alphanumeric characters for eg: "123efg" we get the error report as "missing ) after argument list"
3] When $table is having a string with alphanumeric characters for eg: "efg123" or "abcdfr" we get the error report as "efg123 is not defined" or "abcdfr is not defined".
So I'm having some issue with an ajax call I'm making. The success always returns an empty string no matter if what the php function returns. It seems that looking in firebug the function is called and I've tested it by sending myself an email. It just happens that it is always an empty string. And I am very confused because I developed it on my local server and it worked just fine.
I'm having trouble figuring out exactly how to write the confirmation/validation for the card expiration choices compared to the current date. I have the month and year choices in selection menus, as opposed to text boxes. Code:
The best way to describe what im trying to accomplish is with a code snippet. Im using the free .NET ajax library.
<script language='javascript'> function proc1() { myFunc("MyCodeBehind.MyAjaxProc"); } function myFunc(procName) { procName("My Parameter", processMyFunc); } function processMyFunc(response) { // Process response from the server } </script>
So im essentially invoking an Ajax function , but I cant explicitly use the name of it like so
As you can see below in example #1I am attempting to assign a variable value to the 'URL:' key. I am having problems with this Ajax call but I don't know if this is the cause. I even tried using eval() in example #2 below. I am pretty new at this stuff so forgive my ignorance.
Does the 'url::' key REQUIRE a literal string?? Is there no way to set this value at run time?
Through an AJAX implementation, I am receiving a SQL Query result that has:An object's attribute delimited by a comma.An entire object (database row) delimited by a colon.This is an example response to make it more clear for you.
What I am trying to achieve is placing all of this data into an array. I've set up a little test bed to try and get this to work; this is all I have so far:
var testString = "1,Jeremy,130,80;2,Lauren,370,300;3,Jeancarlos,200,200;4,Luke,330,70;5,Bloom,392,108"; var testArray = new Array(); testArray = testString.split(";");[code]....
get a multi-dimensional array that has information for each person. Example:
FinalArray[0][0] = 1 FinalArray[0][1] = Jeremy FinalArray[0][2] = 130
I am running the scripts below which should return a string containing a URL.So far, it cannot find the form contents in Firefox, but displays the non-dynamic data such as ?Location=. It won't work at all in IE.