JQgrid using http instead of https to load content in OnSelectGrid function, causing Mixed Content Type error

30 Views Asked by At

One of the sites I am working on uses JQgrid to manage a grid of items on its administration page. Selecting one of these items loads up a modal popup that allows said item to be edited. The HTML that builds the grid looks like this:

<div id="tab_business">
                    <div class="jqGrid-wrapper" style="width:995px">
                        <table id='businessGrid' class='jqy-table-to-grid' data='{"idColumn":"ID", "hideColumn":"ID", "title":"Business Channels", "footerRow":false, "editable":"true", "editDialog":"#businessChannelDialog", "editDialogCaption":"Edit Business Cannel", "editAjaxDialog":"true", "editUrl":"@Url.Action("BusinessChannelEdit")", "pager":"#businessChannelGridPager", "pagerRowsView":[5,10,20,100]}'>
                            <thead>
                                <tr>
                                    <th name="ID">ID</th>
                                    <th name="Name">Code</th>
                                    <th name="Description">Description</th>
                                    <th name="CreatedDate">Date Created</th>
                                    <th name="CreatedBy">Created By</th>
                                    <th name="LastUpdateDate">Date Modified</th>
                                    <th name="LastUpdateBy">Modified By</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    foreach (var item in Model.BusinessChannel)
                                    {
                                        <tr>
                                            <td>@item.Id</td>
                                            <td>@item.Code</td>
                                            <td>@item.Description</td>
                                            <td>@item.CreateDate</td>
                                            <td>@item.CreateBy</td>
                                            <td>@item.UpdateDate</td>
                                            <td>@item.UpdateBy</td>
                                        </tr>

                                    }
                                }
                            </tbody>
                        </table>
                        <div id="businessChannelGridPager"></div>

When you select an element from the grid, it invokes "editUrl":"@Url.Action("BusinessChannelEdit")" and makes a request to BusinessChannelEdit function on the backend. However, the site is hosted on HTTPS, and it attempts to make the request to http://(siteurl)/BusinessChannelEdit. Is there any way to force it to use https?

I am using jqGrid 4.3.1 and Jquery 1.7.1

1

There are 1 best solutions below

0
Tony Tomov On

It is a not jqGrid, it is a way you provide the url in editUrl option.

To be a clear:

if your url (@Url.Action("BusinessChannelEdit")) gives

http://example.com/....

but example dot com accepts only https it will provide a error. Be a sure that you url contain https://....

You can look here