Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET Ajax jQuery
Hi all,
 
How to give correct url in ajax method.. my script working with in the project, but after deploying my web services can't reach the url.
my script like
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!--   <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>-->
  <!--  <script src="Scripts/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script>-->
 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
    <script language="javascript" type="text/javascript">
        $("#btnok").live("click", function () {
            var Title = $("#title").val();
            var Type = $("#type").val();
            var name = $("#name").val();
            var city = $("#city").val();
            var state = $("#state").val();
            var date = $("#date").val();
            var Description = $("#description").val();
            var Qualification = $("#qualification").val();
            var Compensation = "2";
            var openings = "20";
            var phone = "999999999";
            var email = "test@gmail.com";
            var zipcode = "56432";
            var job_categories = "5";
            var client_id = "1";
            var data = "{Title:" + JSON.stringify(Title) + ",Type:" + JSON.stringify(Type) + ",Description:" + JSON.stringify(Description) + ",Qualification:" + JSON.stringify(Qualification) + ",Compensation:" + JSON.stringify(Compensation) + ",openings:" + JSON.stringify(openings) + ",city:" + JSON.stringify(city) + ",state:" + JSON.stringify(state) + ",name:" + JSON.stringify(name) + ",phone:" + JSON.stringify(phone) + ",email:" + JSON.stringify(email) + ",date:" + JSON.stringify(date) + ",zipcode:" + JSON.stringify(zipcode) + ",job_categories:" + JSON.stringify(job_categories) + ",client_id:" + JSON.stringify(client_id) + "}";
          //  alert(data);
            $.ajax({
                type: "POST",
                url: "http://192.168.1.100:85/HostingService.asmx?op=SETPostJobDetails",
                data: "{Title:" + JSON.stringify(Title) + ",Type:" + JSON.stringify(Type) + ",Description:" + JSON.stringify(Description) + ",Qualification:" + JSON.stringify(Qualification) + ",Compensation:" + JSON.stringify(Compensation) + ",openings:" + JSON.stringify(openings) + ",city:" + JSON.stringify(city) + ",state:" + JSON.stringify(state) + ",name:" + JSON.stringify(name) + ",phone:" + JSON.stringify(phone) + ",email:" + JSON.stringify(email) + ",date:" + JSON.stringify(date) + ",zipcode:" + JSON.stringify(zipcode) + ",job_categories:" + JSON.stringify(job_categories) + ",client_id:" + JSON.stringify(client_id) + "}",
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                success: function (data, status) {
                    alert(data.d);
                },
                error: function (data, status, error) {
                    alert(error);
                }
//                  error: function(xhr, ajaxOptions, thrownError){
//            alert(thrownError);
//      }
            });
        });
 
    </script>

how to given url line.. please help me
Posted 7-Jan-13 4:31am
Comments
Sandeep Mewara at 7-Jan-13 9:57am
   
Whats the issue with URL? Is that not working and up? If not, find the correct hosted URL and use it.
ryanb31 at 7-Jan-13 10:01am
   
Is there an error? I know IE has a setting to disable cross domain script requests.
Santhosh23 at 7-Jan-13 10:16am
   
hi,
jquery was not called. and it's show the empty alert box.
 
please help me
Member 9581488 at 7-Jan-13 10:39am
   
just an idea:
url: "http://192.168.1.100:85/HostingService.asmx?op=SETPostJobDetails"
try using
url: "http://192.168.1.100:85/HostingService.asmx/SETPostJobDetails"
Santhosh23 at 7-Jan-13 10:58am
   
thanq for replay,
but cant work am tried
Member 9581488 at 7-Jan-13 12:09pm
   
Instead of IP address, try using website name. I would suggest you to use break point and use alert after each line and see where the error comes.
If it shows you empty alert box then its not getting proper data.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

for the cross domain you have to use the JSONP instead of JSON. Please see below for more details
 
http://forums.asp.net/t/1711966.aspx/1[^]
 
Here is the nice article for your reference
 
http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 235
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100