3

Here, I have used check_user function for validating user, but here the http request is not working.

 var $jq="";
 function crossriderMain($) {
    $jq=$;
   //eval(appAPI.resources.get('activate.js'));
   if(!localStorage.adult_option_status ){
       localStorage.adult_option_status = "disable";
       localStorage.adult_option_change = "done";
   }  
} 
function check_user(){
      var user=document.getElementById("username").value;
      var pass=document.getElementById("password").value;
      $jq("#op_sub").attr("disabled",true);
      $jq("#msg_error").hide();


     appAPI.request.post({
      url: "http://www.example.com/parent/ajax/check_adult.php",
      postData: {user:user,pass:pass},
      onSuccess: function(response) {
        alert(response);
      },
      onFailure: function(httpCode) {
        alert(httpCode);
        console.log("postback failure: " + httpCode)
      }
     });

}

Please give me a solution... Thanks in advance

Vipin
  • 847
  • 1
  • 10
  • 21
  • 1
    From the code snippet, it appears you are executing the request in a popup. But there really isn't enough information here to help you. Please explain (1) which browser are you testing on (2) the steps for reproducing the problem (3) are you receiving any error messages or any of the alerts? (4) Why are you creating the global var jQ, it shouldn't be necessary. Also, note that using an alert in a popup automatically closes the popup and defeats the purpose of a popup. Finally, if you provide the extension id, I am happy to take a look for you. [**Disclosure**: I am a Crossrider employee] – Shlomo Jun 30 '14 at 11:23
  • The global variable is setted as to get the jquery access inside the function user_check(). It is not a popup page it is opened via extension by using the following code appAPI.openURL({ resourcePath: "activate.html", where: "tab", }); Actually our problem is not that, appAPI.request.post({ url: "http://www.example.com/parent/ajax/check_adult.php", in the above code the post is not working. It does not shows any error message – Vipin Jun 30 '14 at 12:44
  • That makes sense! I'm so used to crossriderMain being use in popups that I overlooked the openUrl use-case :) Where are you calling check_user? I can't see it in the snippet provided. Any chance you can provide the extension id and I'll take a look? – Shlomo Jun 30 '14 at 14:08
  • Thank you so much for your quick reply.. My Extension id is 58228 – Vipin Jul 01 '14 at 05:51
  • The issue was investigated and a fix was released. I tested the fix on Chrome and it's now working. Please download and install a fresh copy of the extension and let me know if there are any further issues. – Shlomo Jul 06 '14 at 13:51
  • Thanks, that issue is fixed. It was of great help. will keep you posted. – Vipin Jul 07 '14 at 14:48
  • This issue still not fixed firefox but solved in chrome, Is there any way to fix it? – Vipin Jul 15 '14 at 06:30
  • I tried the extension on Firefox and the request work, however the following error message returned in the onSuccess response text: `Notice: Undefined index: user in /var/www/PRIVATE/toolbar/parent/ajax/check_adult.php on line 12 Notice: Undefined index: pass in /var/www/PRIVATE/toolbar/parent/ajax/check_adult.php on line 13 {"status":0}` (I changed the name to PRIVATE :)) – Shlomo Jul 15 '14 at 10:34
  • I have tested extension in firefox 25,24 & 16,It does not show even an alert in external html page, It is working fine with chrome.For testing purpose I used the extension which is in staging mode, it's id is 58229 – Vipin Jul 16 '14 at 09:44
  • Thanks for the additional information, I will follow up with the dev team. – Shlomo Jul 16 '14 at 17:21
  • I have tested on Inernet Explorer as well, bad luck, it is not working..Can you please let me know a possible fix asap... – Vipin Jul 23 '14 at 14:07
  • Thanks for the additional information. – Shlomo Jul 27 '14 at 12:02
  • Please let me know when will you be completed the firefox & IE fix, Our extension is waiting for a launch.. Thanks for advance – Vipin Aug 12 '14 at 14:31
  • I did some further testing and found the FF & IE issue to be the style tag in the **activate.html** file. It shouldn't be an issue in principle but you've discovered a bug which the dev team will look into fixing. In the meantime, you can work around the issue by moving your CSS to a separate resource file (**activate.css**) and including it in your **crossriderMain** function, as follows:`function crossriderMain($) {appAPI.resources.includeCSS("activate.css");}`. Personally, I think this is a cleaner and better way to include your CSS :-) – Shlomo Aug 13 '14 at 11:00

0 Answers0