How to open up a pop up window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dinesh1985singh
    New Member
    • Apr 2010
    • 49

    How to open up a pop up window

    Hello everyone,

    I want to open pop up window through jquery.
    My jquery code is as follows:

    jQuery.ajax({
    url: "/signUp/twit",
    type: "post",
    data: "ajax=true&twit terid=" + jQuery("#profil eTab #twitterid").va l()",
    success: function(respon se,status){

    alert(1);
    }
    });
    here inside success call back i want to open pop up window on some specific response.
    Could someone give me an idea how to do that.And is it possible to use window.open()ja vascript function in jquery to open new pop up window.Because as per my knowledge we can use js functions insside jquery,but window.open() not working.


    Thanks
  • kovik
    Recognized Expert Top Contributor
    • Jun 2007
    • 1044

    #2
    window.open() should work fine unless you are not giving it a valid URL to open. Show us the code that you were using to open the window.

    By the way, this doesn't belong in the PHP forum.

    Comment

    • dinesh1985singh
      New Member
      • Apr 2010
      • 49

      #3
      Thank you kovik, And sorry to post this question on this forum but I just asked it because I am using jquery with php.

      Thanks one more time.

      Comment

      • dinesh1985singh
        New Member
        • Apr 2010
        • 49

        #4
        hi kovik,

        here is my code:

        if(jQuery("#pro fileTab #twitterid").va l() != "")
        {
        alert(jQuery("# profileTab #twitterid").va l() ); jQuery.ajax({
        url: "/signUp/twit",
        type: "POST",
        // data: "ajax=true&twit terid=" + jQuery("#profil eTab #twitterid").va l()",
        success: function(respon se,status){
        alert(response) ;
        if(response == 1)
        {
        window.open("ht tp://www.google.co.i n/","Twitter","wi dth=650,height= 500,resizable=y es,scrollbars=y es,toolbar=yes, location=yes, status=yes,dire ctories=yes,men ubar=yes");

        }



        }
        });

        }

        here every thing works fine only the pop window is not opening up by window.open();

        Morever when I uncomment the data section inside ajax call nothing will happen even a single alert is not working.

        Please help me if possible as soon as possible I get stuck here.

        Thanks

        Comment

        • kovik
          Recognized Expert Top Contributor
          • Jun 2007
          • 1044

          #5
          Firstly, use [code] tags when posting code.

          Secondly, the problem with the data is that you have a stray quotation mark at the end of that line. Your browser's console would be able to tell you that.

          Thirdly, your window.open code looks fine. Have you tried using it without jQuery to confirm that the issue is jQuery? My guess is that your browser's pop-up blocker is stopping your window from showing.

          Comment

          • dinesh1985singh
            New Member
            • Apr 2010
            • 49

            #6
            Thank you Kovik, Nice explanation.
            My Issues has been fixed up now.

            Thank you

            Comment

            • kovik
              Recognized Expert Top Contributor
              • Jun 2007
              • 1044

              #7
              Was it the pop-up blocker? Did I call it or what?! :D

              Comment

              • dinesh1985singh
                New Member
                • Apr 2010
                • 49

                #8
                yes Kovik, it was pop Up blocker that had been blocked.

                Comment

                Working...